Commit Graph

345 Commits

Author SHA1 Message Date
Anthony G. Basile
6740579367 configure.ac: don't die on missing linux/btrfs.h, fixes issue #100
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-11-16 13:40:43 -05:00
Michal Schmidt
03221aa40a hashmap: rewrite the implementation
We reintroduce hashmap.{h,c}, list.h and set.h verbatim from upstream,
before we punt dead code.  The following is the upstream message:

This is a rewrite of the hashmap implementation. Its advantage is lower
memory usage.

It uses open addressing (entries are stored in an array, as opposed to
linked lists). Hash collisions are resolved with linear probing and
Robin Hood displacement policy. See the references in hashmap.c.

Some fun empirical findings about hashmap usage in systemd on my laptop:
  - 98 % of allocated hashmaps are Sets.
  - Sets contain 78 % of all entries, plain Hashmaps 17 %, and
    OrderedHashmaps 5 %.
  - 60 % of allocated hashmaps contain only 1 entry.
  - 90 % of allocated hashmaps contain 5 or fewer entries.
  - 75 % of all entries are in hashmaps that use trivial_hash_ops.

Clearly it makes sense to:
  - store entries in distinct entry types. Especially for Sets - their
    entries are the most numerous and they require the least information
    to store an entry.
  - have a way to store small numbers of entries directly in the hashmap
    structs, and only allocate the usual entry arrays when the direct
    storage is full.

The implementation has an optional debugging feature (enabled by
defining the ENABLE_HASHMAP_DEBUG macro), where it:
  - tracks all allocated hashmaps in a linked list so that one can
    easily find them in gdb,
  - tracks which function/line allocated a given hashmap, and
  - checks for invalid mixing of hashmap iteration and modification.

Since entries are not allocated one-by-one anymore, mempools are not
used for entries. Originally I meant to drop mempools entirely, but it's
still worth it to use them for the hashmap structs. My testing indicates
that it makes loading of units about 5 % faster (a test with 10000 units
where more than 200000 hashmaps are allocated - pure malloc: 449±4 ms,
mempools: 427±7 ms).

Here are some memory usage numbers, taken on my laptop with a more or
less normal Fedora setup after booting with SELinux disabled (SELinux
increases systemd's memory usage significantly):

systemd (PID 1)                            Original   New    Change
dirty memory (from pmap -x 1) [KiB]            2152  1264     -41 %
total heap allocations (from gdb-heap) [KiB]   1623   756     -53 %

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-31 13:28:12 -04:00
Lennart Poettering
ea79c9cdf0 util: make use of the new getrandom() syscall if it is available when needing entropy
Doesn't require an fd, and could be a bit faster, so let's make use of
it, if it is available.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-31 11:58:25 -04:00
Anthony G. Basile
d3e4cb5ccb configure.ac: bump 2.1.1 = upstream 217
Release for bug fix on musl.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-29 16:20:14 -04:00
Anthony G. Basile
acbf3091de configure.ac: bump 2.1 = upstream 217
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-28 20:53:04 -04:00
Anthony G. Basile
429c3a7f17 configure.ac: require automake 1.13
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-15 17:01:33 -04:00
Anthony G. Basile
35257b404e configure.ac: bump 2.0 = upstream 216
Branch v2.X breaks from v1.X in that it removes the userland
firmware loading support.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:56:10 -04:00
Kay Sievers
3b71759460 udev: remove userspace firmware loading support
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:27:22 -04:00
Anthony G. Basile
0f90b52d51 configure.ac and src/libudev/Makefile.am: bump to 1.10 = upstream 216
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-22 08:03:24 -04:00
Anthony G. Basile
b1ac60946d src/shared: refactor shared code
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-05 19:22:24 -04:00
Anthony G. Basile
ba3e123a22 Include missing.h in udev-builtin-btrfs.c, and move BTRFS_IOC_DEVICES_READY to missing.h
This is a combination of upstream commits

    dced15575f7bf172e3c9d798c43477539525558c
    7bed7f0e3b1f9596aedb64657e432e5b267adebb

by

    Simon McVittie <simon.mcvittie@collabora.co.uk>
    7bed7f0e3b1f9596aedb64657e432e5b267adebb

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-05 08:32:35 -04:00
Anthony G. Basile
a51173a35e configure.ac: bump to 1.9 = upstream 215
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-07-06 08:00:08 -04:00
Anthony G. Basile
cd03d84ff0 configure.ac: separate out rootlibdir and rootlibexecdir 2014-06-24 15:28:01 -04:00
Anthony G. Basile
9851827c99 configure.ac: improve install paths for udevlibexecdir, udevkeymapdir, udevkeymapforceredir, udevrulesdir 2014-06-24 13:04:46 -04:00
Anthony G. Basile
441d5c2b39 configure.ac: bump to 1.8 = upstream 214
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-06-19 19:58:05 -04:00
Anthony G. Basile
9ea99e7409 configure.ac: bump to 1.7 = upstream 213
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-06-01 14:14:12 -04:00
Zbigniew Jedrzejewski-Szmek
f8e5fbd9c8 Remove unnecessary casts in printfs
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-05-15 19:34:56 -04:00
Anthony G. Basile
47ef6b2c66 src/libudev/missing.h: clean up and fix build on uclibc and musl
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-05-13 10:53:21 -04:00
Kay Sievers
2500dbc810 udev: remove seqnum API and all assumptions about seqnums
The way the kernel namespaces have been implemented breaks assumptions
udev made regarding uevent sequence numbers. Creating devices in a
namespace "steals" uevents and its sequence numbers from the host. It
confuses the "udevadmin settle" logic, which might block until util a
timeout is reached, even when no uevent is pending.

Remove any assumptions about sequence numbers and deprecate libudev's
API exposing these numbers; none of that can reliably be used anymore
when namespaces are involved.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-04-24 15:40:08 -04:00
Anthony G. Basile
a1a5424a62 configure.ac: bring version numbers in line with upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-04-03 13:31:29 -04:00
Anthony G. Basile
6330a66ad2 configure.ac: bump to 1.5.3
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-03-22 18:44:40 -04:00
lhb-jr
8a5de44bb8 modified: configure.ac
modified:   man/Makefile.am
Added checking for DocBook in configure
2014-03-20 20:51:06 -04:00
Anthony G. Basile
e0aa59ede2 configure.ac: bump to version 1.5.2
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-03-09 13:43:28 -04:00
Anthony G. Basile
3836f0afa1 configure.ac: bump to version 1.5.1 2014-03-04 09:32:50 -05:00
Anthony G. Basile
e906d02b61 configure.ac: bump to version 1.5 2014-02-28 17:35:51 -05:00
Anthony G. Basile
e33d2cfc5e src/udev: bring up to date with upstream.
These commits were authored by

    Zbigniew Jędrzejewski-Szmek
    Tom Gundersen
    Kay Sievers
    Lennart Poettering
    Shawn Landden
    Daniel Buch
    Martin Pitt
    Karel Zak
    Yang Zhiyong

Note: udev_builtin_net_setup_link has *not* been imported.  Also
still missing from udev-builtin is udev_builtin_uaccess.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-13 18:16:50 -05:00
Anthony G. Basile
e27fa9c2e7 configure.ac: add header check for mtd/mtd-user.h
This addresses

    https://github.com/gentoo/eudev/issues/73

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-09-26 11:31:01 -04:00
Anthony G. Basile
1cd005527a configure.ac: compat with upstream 207 2013-09-14 09:42:28 -04:00
Anthony G. Basile
320c6723e7 configure.ac: moving towards release 1.3 2013-09-10 07:22:04 -04:00
rofl0r
167bc800b7 configure.ac: remove check for mktime
mktime is not used anywhere in the code, and the stock configure
check for mktime invokes UB, so lets just remove it.

closes #71
2013-08-16 07:32:35 +02:00
Anthony G. Basile
a57c8bba0d configure.ac: compatible with systemd 206
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-02 19:56:24 -04:00
Ian Stakenvicius
9a769172c3 Revert "static-nodes: remove creation of static nodes if HAVE_LIBKMOD"
This reverts commit aa417a4d83.

Preface:  The kmod+tmpfiles static dev-node creation requires two commands to
be executed at runtime -- it is not something that will automatically occur
without a system's setup being explicitly designed or changed so that these
commands are executed.

Preface2:  In order for the kmod+tmpfiles static dev-node creation to work
properly, that -must- be executed at startup before {systemd-,}udevd starts.
The reason for this is because udevd will only set permissions on those files
at startup, and so if udevd starts beforehand then these nodes will exist with
permissions that are (probably) too restrictive.

The function in udevd which creates static-nodes is non-fatal and only updates
mtime on the devnodes if they already exist.  As such, if a system is configured
to execute kmod+tmpfiles to create static-nodes, because that must occur first,
eudev's udevd will not conflict.  Also, if a system does not execute kmod+tmpfiles,
then eudev will still create the static devnodes, even if kmod-14 or higher is
installed.

There *may* be a conflict if kmod+tmpfiles is executed after udevd starts, but
as per "preface2" this is not a supported configuration.

Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31 13:07:33 -04:00
Anthony G. Basile
aa417a4d83 static-nodes: remove creation of static nodes if HAVE_LIBKMOD
This address upstream commit edeb68c53f1cdc452016b4c8512586a70b1262e3
and https://bugs.gentoo.org/show_bug.cgi?id=477890.  If eudev is
configured with --enable-libkmod then we check for kmod >= 14 and
ifdef out the code removed in the upstream commit.  Otherwise we
retain it for modutils.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-31 10:46:49 -04:00
Ian Stakenvicius
35876baf30 Switch from external keymaps to internal (hwdb) keymaps
This commit imports the new internal keyboard handling from upstream.
This is a combination of many upstream commits, including those
that added code, removed old code, and updated the hwdb.
Some commits (hwdb ones specifically) were unrelated but brought
in anyways to keep the whole hwdb consistent.  Each upstream
commit included is as follows:

9d7d42bc406a2ac04639674281ce3ff6beeda790 - internal keymap support
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1 - hwdb: keyboard -- add file
e8193554925a22b63bef0e77b8397b56d63a91ff - hwdb: keyboard -- update comments
c79d894d590fc9df4861738555cc43c477e33376 - hwdb: import data
aedc2eddd16e48d468e6ad0aea2caf00c7d37365 - hwdb: keyboard update
97a9313cafccf772ce03f5ebd36fe4d9d8412583 - hwdb: drop non-existant Samsung 900XC3 from keymap
ddc77f62244bb41d5c8261517e2e1ff1b763fc94 - switch from udev keymaps to hwdb
0c3815773331b263713f4f7b9d80bc1ca159338e - also remove keymaps-force-release directory
1b6bce89b3383904d0dab619dd38bff673f7286e - keymap: re-add Logitech USB corded/cordless models
bf89b99c5a39115112c2eda4c2103e2db54988d2 - 60-keyboard.hwdb: Fix syntax error
ce39bb6909578017aa10031638e724e038f0b859 - hwdb: data update, upstream
884c86812c51479496edd50b278383d7bb67baf0 - rules: keyboard - use builtin command

All code from each of the above commits is attributed to the original
authors.

There were some adjustments made in order to support the code differences
between upstream and eudev, which was done by myself.

Also of note is that the code can still be disabled via the --disable-keymaps
configure option, which was removed from upstream.

Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-24 16:27:01 -04:00
Anthony G. Basile
1fdae2bccb Version bump to 1.1
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-11 09:05:41 -04:00
Anthony G. Basile
604b9042e3 Version bump to 1.0, dropping _beta tag
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-09 05:08:04 -04:00
Anthony G. Basile
1cc8667cd9 Remove libudev-legacy
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04 05:41:20 -04:00
Anthony G. Basile
1fcf167f65 Version bump to eudev-1_beta4
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-10 22:11:37 -04:00
Kay Sievers
faed3b5ff1 build-sys: fix HAVE/ENABLE_FIRMWARE
This fixes:

    https://github.com/gentoo/eudev/issues/55
    https://bugs.freedesktop.org/show_bug.cgi?id=62864

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-09 17:47:19 -04:00
Anthony G. Basile
df016d6d7a src/udev/udev-event.c: restore code to allow rule generator to work
This code was dropped while importing from upstream.  It is needed
to allow the legacy renaming of interfaces like eth* or wlan*.

X-Eudev-Bug: 56
X-Eudev-Bug-URL: https://github.com/gentoo/eudev/issues/56
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-07 22:19:54 -04:00
Ian Stakenvicius
060ec6fee0 bump versions to eudev-1_beta3 and udev-200 2013-04-05 10:57:04 -04:00
Ian Stakenvicius
1d70a98af4 Set rootprefix to be '${prefix}' if unset
Previously, rootprefix was set to the actual value of the default prefix,
which caused issues when running 'make distcheck' since prefix is set
to a non-standard value but rootprefix is unset.  By assigning the variable
rather than its contents, this should now be avoided.
2013-04-04 12:59:24 -04:00
Ian Stakenvicius
c4657beb83 set default prefix to /usr for necessary rootprefix default operation 2013-04-04 12:06:05 -04:00
Ian Stakenvicius
d71bb748b2 Removed hard-coded paths in rule-writer scripts
Both scripts had hard-coded paths to 'rule_generator.functions'; these were changed
to be substituted in by configure so the paths will match where files are
installed.øy

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-04 10:26:47 -04:00
Ian Stakenvicius
85085621ba Restored the rule generator bits from udev-171
This restores the rule generator scripts for the persistent
network and optical device rule generator scripts that were
removed after udev-171, and re-introduces their installation
to the build system.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-04 10:19:35 -04:00
Tom Gundersen
f3ea87f611 udev: make firmware loading optional and disable by default
Distros that whish to support old kernels should set
  --with-firmware-dirs="/usr/lib/firmware/updates:/usr/lib/firmware"
to retain the old behaviour.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-04-02 13:54:36 -04:00
Anthony G. Basile
2251933e50 Fix whitespace in various files
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-03-14 18:05:30 -04:00
Anthony G. Basile
489ca457ea Only check for gperf if --enable-keymap
gperf is only used to generate some header file for src/keymap,
and so we should only test for its existence if --enable-keymap
is given.

See:
 https://github.com/gentoo/eudev/issues/50
 https://bugs.gentoo.org/show_bug.cgi?id=452760

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-03-10 14:50:10 -04:00
Ian Stakenvicius
94d7639cf2 Make udevlibexecdir be /lib
ie, fix another regression in our build system ; gentoo bug 455326

it's common for eg. mips systems to not have symlink from the directory
{lib32 or lib64} to /lib.  only the libraries belong to /$(get_libdir) and
everything in /lib/udev goes to, well, /lib/udev, NOT /$(get_libdir)/udev
     -- ssuominen

Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-02-04 11:22:30 -05:00
Ian Stakenvicius
c661732bc2 Fix AM_CONDITIONAL for HAVE_BLKID
Corrects error caused in commit a9ef3ca764

Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
Signed-off-by: Matthew Thode <prometheanfire@gentoo.org>
2013-01-29 09:10:41 -05:00