1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

20161 Commits

Author SHA1 Message Date
Lennart Poettering
dd168445f8 dhcp: yes, infiniband has the larger MAC address length, but let the compuler figure that out... 2015-04-12 20:15:08 +02:00
Lennart Poettering
3d8dcaf1da efi-boot-generator: need need to proceed if /boot is already a mount point 2015-04-12 20:01:07 +02:00
Tobias Hunger
eafe88e34a gpt-generator: Find device on a stateless system
A stateless system has a tmpfs as root file system. That obviously
does not have any block device associated with it. So try falling back
to the device of the /usr filesystem if the root filesystem fails.
2015-04-12 20:00:21 +02:00
Simon Farnsworth
9f1a574d50 python-systemd: fix is_socket_inet to cope with ports
Just a couple of trivial oversights.
2015-04-12 10:20:36 -04:00
Tobias Hunger
776c441941 efi-boot-generator: Continue if /boot does not exist
/boot does not exist on a stateless system, so do not get
confused by that.
2015-04-12 10:20:36 -04:00
Zbigniew Jędrzejewski-Szmek
a61cc460e8 bus-util: add articles to explanation messages
We are talking about one member of a group of things (resource limits, signals,
timeouts), without specifying which one. An indenfinite article is in order.

When we are talking about the control process, it's a specific one, so the
definite article is used.
2015-04-12 10:20:36 -04:00
Zbigniew Jędrzejewski-Szmek
f8bc41822b sysv-generator: free LookupPaths also on error
Followup for 7a03974a6f.
2015-04-12 10:20:36 -04:00
Zbigniew Jędrzejewski-Szmek
c89280f811 udev-builtin-keyboard: make error messages more standard
- No need to add "Error, " prefix, we already have that as metadata.
- Also use double quotes for path names, as in most other places.
- Remove stray newline at end of message.
- Downgrade error messages after which we continue to warnings.
2015-04-12 10:20:36 -04:00
Zbigniew Jędrzejewski-Szmek
c7e3c3ecac rules: finish incomplete rename
Fixup for 51c0c28698.
2015-04-12 10:20:24 -04:00
Zbigniew Jędrzejewski-Szmek
dd449aca61 tmpfiles: use qsort_safe 2015-04-12 10:20:24 -04:00
Thomas Hindoe Paaboel Andersen
7a03974a6f sysv-generator: fix mem leaks 2015-04-11 13:47:56 +02:00
David Herrmann
98a4c30ba1 bus: implement bus_path_{en,de}code_unique()
Whenever we provide a bus API that allows clients to create and manage
server-side objects, we need to provide a unique name for these objects.
There are two ways to provide them:
  1) Let the server choose a name and return it as method reply.
  2) Let the client pass its name of choice in the method arguments.

The first method is the easiest one to implement. However, it suffers from
a race condition: If a client creates an object asynchronously, it cannot
destroy that object until it received the method reply. It cannot know the
name of the new object, thus, it cannot destroy it. Furthermore, this
method enforces a round-trip. If the client _depends_ on the method call
to succeed (eg., it would close() the connection if it failed), the client
usually has no reason to wait for the method reply. Instead, the client
can immediately schedule further method calls on the newly created object
(in case the API guarantees in-order method-call handling).

The second method fixes both problems: The client passes an object name
with the method-call. The server uses it to create the object. Therefore,
the client can schedule object destruction even if the object-creation
hasn't finished, yet (again, requiring in-order method-call handling).
Furthermore, the client can schedule further method calls on the newly
created object, before the constructor returned.

There're two problems to solve, though:
  1) Object names are usually defined via dbus object paths, which are
     usually globally namespaced. Therefore, multiple clients must be able
     to choose unique object names without interference.
  2) If multiple libraries share the same bus connection, they must be
     able to choose unique object names without interference.

The first problem is solved easily by prefixing a name with the
unique-bus-name of a connection. The server side must enforce this and
reject any other name.
The second problem is solved by providing unique suffixes from within
sd-bus. As long as sd-bus always returns a fresh new ID, if requested,
multiple libraries will never interfere. This implementation re-uses
bus->cookie as ID generator, which already provides unique IDs for each
bus connection.

This patch introduces two new helpers:
  bus_path_encode_unique(sd_bus *bus,
                         const char *prefix,
                         const char *sender_id,
                         const char *external_id,
                         char **ret_path);
    This creates a new object-path via the template
    '/prefix/sender_id/external_id'. That is, it appends two new labels to
    the given prefix. If 'sender_id' is NULL, it will use
    bus->unique_name, if 'external_id' is NULL, it will allocate a fresh,
    unique cookie from bus->cookie.

  bus_path_decode_unique(const char *path,
                         const char *prefix,
                         char **ret_sender,
                         char **ret_external);
    This reverses what bus_path_encode_unique() did. It parses 'path' from
    the template '/prefix/sender/external' and returns both suffix-labels
    in 'ret_sender' and 'ret_external'. In case the template does not
    match, 0 is returned and both output arguments are set to NULL.
    Otherwise, 1 is returned and the output arguments contain the decoded
    labels.

Note: Client-side allocated IDs are inspired by the Wayland protocol
      (which itself was inspired by X11). Wayland uses those IDs heavily
      to avoid round-trips. Clients can create server-side objects and
      send method calls without any round-trip and waiting for any object
      IDs to be returned. But unlike Wayland, DBus uses gobally namespaced
      object names. Therefore, we have to add the extra step by adding the
      unique-name of the bus connection.
2015-04-11 13:27:49 +02:00
David Herrmann
ad922737f7 bus: implement bus_label_unescape_n()
This is like bus_label_unescape() but takes a maximum length instead of
relying on NULL-terminated strings. This is highly useful to unescape
labels that are not at the end of a path.
2015-04-11 13:14:57 +02:00
David Herrmann
cfe561a456 hashmap: return NULL from destructor
We _always_ return NULL from destructors to allow direct assignments to
the variable holding the object. Especially on hashmaps, which treat NULL
as empty hashmap, this is pretty neat.
2015-04-11 13:14:41 +02:00
Daniel Drake
07ba8037bf udevd: fix synchronization with settle when handling inotify events
udev uses inotify to implement a scheme where when the user closes
a writable device node, a change uevent is forcefully generated.
In the case of block devices, it actually requests a partition rescan.

This currently can't be synchronized with "udevadm settle", i.e. this
is not reliable in a script:

 sfdisk --change-id /dev/sda 1 81
 udevadm settle
 mount /dev/sda1 /foo

The settle call doesn't synchronize there, so at the same time we try
to mount the device, udevd is busy removing the partition device nodes and
readding them again. The mount call often happens in that moment where the
partition node has been removed but not readded yet.

This exact issue was fixed long ago:
http://git.kernel.org/cgit/linux/hotplug/udev.git/commit/?id=bb38678e3ccc02bcd970ccde3d8166a40edf92d3

but that fix is no longer valid now that sequence numbers are no longer
used.

Fix this by forcing another mainloop iteration after handling inotify events
before unblocking settle. If the inotify event caused us to generate a
"change" event, we'll pick that up in the following loop iteration, before
we reach the end of the loop where we respond to settle's control message,
unblocking it.
2015-04-11 13:10:52 +02:00
Gavin Li
af97ebf2dd hwdb: add Samsung ATIV Book 6 / 8
This adds support for the keyboard illumination keys and fixes
Fn+F1.
2015-04-11 12:54:08 +02:00
Marc-Antoine Perennou
c4a77bcb9a build: allow setting OBJCOPY 2015-04-11 12:48:18 +02:00
Marc-Antoine Perennou
63e69fb4a0 configure: allow setting EFI_CC 2015-04-11 12:43:47 +02:00
Marc-Antoine Perennou
531ddb915b efi: use EFI_CC 2015-04-11 12:41:43 +02:00
Marc-Antoine Perennou
0a5d1ed9b5 factory: install to datadir 2015-04-11 12:39:53 +02:00
Nir Soffer
0736455b11 udev: restore udevadm settle timeout
Commit 9ea28c55a2 (udev: remove seqnum API and all assumptions about
seqnums) introduced a regresion, ignoring the timeout option when
waiting until the event queue is empty.

Previously, if the udev event queue was not empty when the timeout was
expired, udevadm settle was returning with exit code 1.  To check if the
queue is empty, you could invoke udevadm settle with timeout=0. This
patch restores the previous behavior.

(David: fixed timeout==0 handling and dropped redundant assignment)
2015-04-11 12:35:07 +02:00
Matthew Garrett
64713f9252 rules: fix tests for removable state
We only care about whether our direct parent is removable, not whether any
further points up the tree are - the kernel will take care of policy for
those itself. This enables autosuspend on devices where the root hub reports
that its removable state is unknown.
2015-04-11 12:22:17 +02:00
Łukasz Stelmach
3dd26f3e3a README: glibc version 2.16 is required for IP_UNICAST_IF
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=be08eda5
https://bugs.gentoo.org/show_bug.cgi?id=546194
2015-04-11 12:19:10 +02:00
David Herrmann
d4b47aa30b TODO: add 13790add4 as blocker for v220 2015-04-11 12:13:24 +02:00
Koen Kooi
684edf2e19 build: add support for AARCH64 EFI
Aarch64 and ARM32 lack an EFI capable objcopy, so use the ldflags + -O
binary trick gnu-efi and the Red Hat shimloader are using.

(David: rebase to systemd-git and added EFI_ prefixes)
2015-04-11 12:09:56 +02:00
Koen Kooi
0d8d368907 boot/util: add ticks_read() stub 2015-04-11 11:54:45 +02:00
Koen Kooi
4c6abc93c7 build: add AARCH64 efi support
This is just plumbing to add ARCH_AARCH64 EFI support for makefile tests
and defining the machine name.
2015-04-11 11:48:56 +02:00
Koen Kooi
8403daa284 boot/util: use x86 ASM only on x86 platforms. 2015-04-11 11:48:39 +02:00
Koen Kooi
32ef61b888 build: support non-x86 EFI builds
Move the no-mmx/no-sse CFLAGS to X86-64 and IA32 defines in preparation
for ARM32 and Aarch64 support.
2015-04-11 11:39:29 +02:00
Peter Hutterer
3ebc2dc498 hwdb: set the resolution for a couple of bcm5974 touchpads
Verified for the 5,1 Macbook, the others are guesses based on the list of
supported devices of the moshi trackpad protector.
http://www.moshi.com/trackpad-protector-trackguard-macbook-pro#silver

Resolution calculated based on the min/max settings set in the kernel driver,
divided by the physical size. This is probably slightly off, but still better
than no resolution at all.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-11 08:44:33 +10:00
Peter Hutterer
51c0c28698 udev: builtin-keyboard: add support for EVDEV_ABS_*
Parse properties in the form
EVDEV_ABS_00="<min>:<max>:<res>:<fuzz>:<flat>"

and apply them to the kernel device. Future processes that open that device
will see the updated EV_ABS range.

This is particularly useful for touchpads that don't provide a resolution in
the kernel driver but can be fixed up through hwdb entries (e.g. bcm5974).

All values in the property are optional, e.g. a string of "::45" is valid to
set the resolution to 45.

The order intentionally orders resolution before fuzz and flat despite it
being the last element in the absinfo struct. The use-case for setting
fuzz/flat is almost non-existent, resolution is probably the most common case
we'll need.

To avoid multiple hwdb invocations for the same device, replace the
hwdb "keyboard:" prefix with "evdev:" and drop the separate 60-keyboard.rules
file. The new 60-evdev.rules is called for all event nodes
anyway, we don't need a separate rules file and second callout to the hwdb
builtin.
2015-04-11 08:44:33 +10:00
Peter Hutterer
8a0fd83cf0 udev: builtin-keyboard: invert a condition
No functional changes, just to make the next patch easier to review
2015-04-11 08:44:33 +10:00
Peter Hutterer
c9a8e34094 udev: builtin-keyboard: move actual key mapping to a helper function
No changes in the mapping, but previously we opened the device only on
successful parsing. Now we open the mapping as soon as we have a value that
looks interesting. Since errors are supposed to be the exception, not the
rule, this is probably fine.
2015-04-11 08:44:33 +10:00
Peter Hutterer
cfba2656e3 udev: builtin-keyboard: immediately EVIOCSKEYCODE when we have a pair
Rather than building a map and looping through the map, immediately call the
ioctl when we have a successfully parsed property.

This has a side-effect: before the maximum number of ioctls was limited to the
size of the map (1024), now it is unlimited.
2015-04-11 08:44:33 +10:00
Peter Hutterer
753bd5c7ed udev: builtin-keyboard: move fetching the device node up
No point parsing the properties if we can't get the devnode to apply them
later. Plus, this makes future additions easier to slot in.
2015-04-11 08:44:33 +10:00
Ronny Chevalier
3c8000956a shared: move replace_env* from util to env-util 2015-04-11 00:34:03 +02:00
Ronny Chevalier
288a74cce5 shared: add terminal-util.[ch] 2015-04-11 00:34:02 +02:00
Ronny Chevalier
3df3e884ae shared: add random-util.[ch] 2015-04-11 00:11:13 +02:00
Ronny Chevalier
0b452006de shared: add process-util.[ch] 2015-04-10 23:54:49 +02:00
Ronny Chevalier
6482f6269c shared: add formats-util.h 2015-04-10 23:54:48 +02:00
Thomas Hindoe Paaboel Andersen
05a08cb60f dbus: typo fix in log 2015-04-10 23:39:40 +02:00
Thomas Hindoe Paaboel Andersen
75c2a9fd13 tmpfiles: fix build with clang
Clang is not happy about using the cleanup attribute in switches
2015-04-10 23:28:08 +02:00
Thomas Hindoe Paaboel Andersen
733dbdc534 efivars: fix build for non-efi 2015-04-10 23:00:07 +02:00
Tom Gundersen
2e036c4eae shared: boot-timestamps - remove ifdef
No need to ifdef out efi code as the functions are always defined.
2015-04-10 19:55:49 +02:00
Tom Gundersen
b28ce7c6db shared: efivars - fix compile on non-EFI systems
systemctl and logind were unconditionally using functions that were not compiled
on non-EFI systems. Add stubs returning -EOPNOTSUPP to fix compile again.
2015-04-10 19:55:49 +02:00
Tom Gundersen
9df49b3358 shared: efivars - is_efi_*() returns bool instead of int
There was a bug where is_efi_*() could return a negative error value, which would be treated as 'true',
just make this a bool in the helper library to avoid the problem.
2015-04-10 19:55:49 +02:00
Lennart Poettering
3dc055541c Revert "sd-dhcp-client: fix strict aliasing issue"
This reverts commit 6ec8e7c763.

This doesn't fix any issues, just makes the code harder to read.
2015-04-10 19:04:43 +02:00
Lennart Poettering
53bac4e0e3 sd-event: simplify sd_event_run() 2015-04-10 18:45:39 +02:00
Lennart Poettering
5c5ccf12b6 tmpfiles: add specifier expansion for L and C lines, too 2015-04-10 18:07:04 +02:00
Lennart Poettering
b1b5922e2f update TODO 2015-04-10 17:36:07 +02:00