1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00
Commit Graph

18418 Commits

Author SHA1 Message Date
Lennart Poettering
cd61c3bfd7 machined/machinectl: add logic to show list of available images
This adds a new bus call to machined that enumerates /var/lib/container
and returns all trees stored in it, distuingishing three types:

        - GPT disk images, which are files suffixed with ".gpt"
        - directory trees
        - btrfs subvolumes
2014-12-19 19:19:29 +01:00
Lennart Poettering
8eebf6ad55 util: when creating temporary filename for atomic creation of files, add an extra "#" to the name
That way, we have a simple, somewhat reliable way to detect such
temporary files, by simply checking if they start with ".#".
2014-12-19 19:19:29 +01:00
Michal Schmidt
668c965af4 journal: skipping of exhausted journal files is bad if direction changed
EOF is meaningless if the direction of iteration changes.
Move the EOF optimization under the direction check.

This fixes test-journal-interleaving for me.

Thanks to Filipe Brandenburger for telling me about the failure.
2014-12-19 17:14:11 +01:00
Michal Schmidt
b29ddfcb38 journal: make next_with_matches() always use f->current_offset
next_with_matches() is odd in that its "unit64_t *offset" parameter is
both input and output. In other it's purely for output.

The function is called from two places in next_beyond_location(). In
both of them "&cp" is used as the argument and in both cases cp is
guaranteed to equal f->current_offset.

Let's just have next_with_matches() ignore "*offset" on input and
operate with f->current_offset.

I did not investigate why it is, but it makes my usual benchmark run
reproducibly faster:

$ time ./journalctl --since=2014-06-01 --until=2014-07-01 > /dev/null

real    0m4.032s
user    0m3.896s
sys     0m0.135s

(Compare to preceding commit, where real was 4.4s.)
2014-12-19 16:15:21 +01:00
Michal Schmidt
487d37209b journal: fix skipping of duplicate entries in iteration
I accidentally broke the detection of duplicate entries in 7943f42275
"journal: optimize iteration by returning previously found candidate
entry".

When we have a known location of a candidate entry, we must not return
from next_beyond_location() immediately. We must go through the
duplicates detection to make sure the candidate differs from the
already iterated entry.

This fix slows down iteration a bit, but it's still faster than it
was before the rework.

$ time ./journalctl --since=2014-06-01 --until=2014-07-01 > /dev/null

real    0m4.448s
user    0m4.298s
sys     0m0.149s

(Compare with results from commit 7943f42275, where real was 5.3s before
the rework.)
2014-12-19 15:37:10 +01:00
Tom Gundersen
bfcdba8d56 networkd: link - plug leak 2014-12-19 08:34:04 +01:00
Tom Gundersen
19727828d2 networkctl: lldp - respect arg_legend 2014-12-19 08:33:46 +01:00
Susant Sahani
49699bac94 LLDP: Add support for networkctl 2014-12-19 08:15:05 +05:30
Susant Sahani
ce43e48446 networkd: integrate LLDP
This patch integrates LLDP with networkd.

Example conf:
file : lldp.network

[Match]
Name=em1

[Network]
LLDP=yes
2014-12-19 08:02:45 +05:30
Susant Sahani
ad1ad5c8e3 networkd: Introduce Link Layer Discovery Protocol (LLDP)
This patch introduces LLDP support to networkd. it implements the
receiver side of the protocol.

The Link Layer Discovery Protocol (LLDP) is an industry-standard,
vendor-neutral method to allow networked devices to advertise
capabilities, identity, and other information onto a LAN. The Layer 2
protocol, detailed in IEEE 802.1AB-2005.LLDP allows network devices
that operate at the lower layers of a protocol stack (such as
Layer 2 bridges and switches) to learn some of the capabilities
and characteristics of LAN devices available to higher
layer protocols.
2014-12-19 08:02:45 +05:30
Tom Gundersen
266b538958 networkctl: port to verbs helper 2014-12-19 03:16:45 +01:00
Tom Gundersen
caa8dab28f systemd-hwdb: port to new verbs helper 2014-12-19 03:02:55 +01:00
Tom Gundersen
eac8e8c6de import: dck - fix curl error handling 2014-12-19 03:00:56 +01:00
Lennart Poettering
c3a0d00d6d update TODO 2014-12-19 02:08:14 +01:00
Lennart Poettering
72648326ea import: add new minimal tool "systemd-import" for pulling down foreign containers and install them locally
This adds a simply but powerful tool for downloading container images
from the most popular container solution used today. Use it like
this:

       # systemd-import pull-dck mattdm/fedora
       # systemd-nspawn -M fedora

This will donwload the layers for "mattdm/fedora", and make them
available locally as /var/lib/container/fedora.

The tool is pretty complete, as long as it's only about pulling down
images, or updating them. Pushing or searching is not supported yet.
2014-12-19 02:08:14 +01:00
Lennart Poettering
dca59f6266 util: add generalization of verb parsing for command line tools
We should move loginctl, timedatectl, machinectl over to use this new
API instead of a manual one.
2014-12-19 02:07:42 +01:00
Lennart Poettering
e02d225b1e util: make sure rm_rf() can be called on symlinks (with the effect of deleting it) 2014-12-19 02:07:42 +01:00
Lennart Poettering
e1dd6790e4 strv: ass new strv_is_uniq() and strv_reverse() calls 2014-12-19 02:07:42 +01:00
Lennart Poettering
24167f3db8 execute: the runtime directory can only be on tmpfs, hence don't use rm_rf_dangerous() needlessly 2014-12-19 02:07:42 +01:00
Lennart Poettering
b7d1319393 nss-myhostname: introduce is_gateway() similar to the existing is_hostname() 2014-12-19 02:07:42 +01:00
Zbigniew Jędrzejewski-Szmek
c853953658 load-fragment: allow quoting in command name and document allowed escapes
The handling of the command name and other arguments is unified. This
simplifies things and should make them more predictable for users.
Incidentally, this makes ExecStart handling match the .desktop file
specification, apart for the requirment for an absolute path.

https://bugs.freedesktop.org/show_bug.cgi?id=86171
2014-12-18 19:26:21 -05:00
Zbigniew Jędrzejewski-Szmek
ba774317ac Treat a trailing backslash as an error
Commit a2a5291b3f changed the parser to reject unfinished quoted
strings. Unfortunately it introduced an error where a trailing
backslash would case an infinite loop. Of course this must fixed, but
the question is what to to instead. Allowing trailing backslashes and
treating them as normal characters would be one option, but this seems
suboptimal. First, there would be inconsistency between handling of
quoting and of backslashes. Second, a trailing backslash is most
likely an error, at it seems better to point it out to the user than
to try to continue.

Updated rules:
ExecStart=/bin/echo \\ → OK, prints a backslash
ExecStart=/bin/echo \ → error
ExecStart=/bin/echo "x → error
ExecStart=/bin/echo "x"y → error
2014-12-18 19:26:21 -05:00
Zbigniew Jędrzejewski-Szmek
30bcc05295 test-strv: use STRV_MAKE 2014-12-18 19:26:21 -05:00
Zbigniew Jędrzejewski-Szmek
447021aafd tree-wide: make condition_free_list return NULL 2014-12-18 19:26:21 -05:00
Zbigniew Jędrzejewski-Szmek
f1acf85a36 core: make exec_command_free_list return NULL 2014-12-18 19:26:21 -05:00
Zbigniew Jędrzejewski-Szmek
f08fa3be8d hwdb: move Logitech mouse to the right spot 2014-12-18 18:54:01 -05:00
Erik Auerswald
90d37f7e8f hwdb: Logitech, Inc. RX 250 Optical Mouse DPI data
https://bugs.freedesktop.org/show_bug.cgi?id=87435
2014-12-18 18:54:00 -05:00
Tim JP
171347760e hwdb: Logitech, Inc. RX 300 Optical Mouse DPI data
https://bugs.freedesktop.org/show_bug.cgi?id=87456
2014-12-18 18:54:00 -05:00
Zbigniew Jędrzejewski-Szmek
dbf1f77bf7 test-cap-list: allow mismatch in case 2014-12-18 18:54:00 -05:00
Dave Reisner
e40872fc53 path-util: fix breakage in path_is_mount_point
This fixes 2 problems introduced by 6feeeab0bc:

1) If name_to_handle_at returns ENOSYS for the child, we'll wrongly
return -ENOSYS when it returns the same for the parent. Immediately
jump to the fallback logic when we get ENOSYS.

2) If name_to_handle_at returns EOPNOTSUPP for the child but suceeds
for the parent, we'll be comparing an uninitialized value (mount_id) to
an initialized value (mount_id_parent). Initialize the mount_id
variables to invalid mount_ids to avoid this.
2014-12-18 18:34:12 -05:00
Tom Gundersen
65eb4378c3 systemd-hwdb: introduce new tool
This pulls out the hwdb managment from udevadm into an independent tool.

The old code is left in place for backwards compatibility, and easy of
testing, but all documentation is dropped to encourage use of the new
tool instead.
2014-12-18 15:37:27 +01:00
Alin Rauta
b98b483bac networkd: add FDB support 2014-12-18 15:28:16 +01:00
Michal Schmidt
c2551e7105 journal: next_with_matches() now does not need a mapped object as input
Now that journal_file_next_entry() does not need a pointer to the
current object, next_with_matches() does not need it either.
2014-12-18 14:44:34 +01:00
Michal Schmidt
f534928ad7 journal: journal_file_next_entry() does not need pointer to current Object
The current offset is sufficient information.
2014-12-18 14:41:22 +01:00
Michal Schmidt
7943f42275 journal: optimize iteration by returning previously found candidate entry
In next_beyond_location() when the JournalFile's location type is
LOCATION_SEEK, it means there's nothing to do, because we already have
the location of the candidate entry. Do an early return. Note that now
next_beyond_location() does not anymore guarantee on return that the
entry is mapped, but previous patches made sure the caller does not
care.

This optimization is at least as good as "journal: optimize iteration:
skip files that cannot improve current candidate entry" was.

Timing results on my workstation, using:
$ time ./journalctl -q --since=2014-06-01 --until=2014-07-01 > /dev/null

Before "Revert "journal: optimize iteration: skip files that cannot
improve current candidate entry":

real    0m5.349s
user    0m5.166s
sys     0m0.181s

Now:

real    0m3.901s
user    0m3.724s
sys     0m0.176s
2014-12-18 14:35:30 +01:00
Michal Schmidt
6e693b42dc journal: optimize iteration by skipping exhausted files
If from a previous iteration we know we are at the end of a journal
file, don't bother looking into the file again. This is complicated by
the fact that the EOF does not have to be permanent (think of
"journalctl -f"). So we also check if the number of entries in the
journal file changed.

This optimization has a similar effect as "journal: optimize iteration:
skip whole files behind current location" had.
2014-12-18 14:29:46 +01:00
Michal Schmidt
58439db4cc journal: drop unnecessary parameters of next_beyond_location()
offset is redundant, because the caller can rely on f->current_offset.
The object pointer the function saves in *ret is thrown away by the caller.
2014-12-18 12:44:16 +01:00
Michal Schmidt
e499c9998b journal: remove redundant variable new_offset
The file's current_offset is already updated at this point, so let's use
it.
2014-12-18 12:28:24 +01:00
Michal Schmidt
d8ae66d7fa journal: compare candidate entries using JournalFiles' locations
When comparing the locations of candidate entries, we can rely on the
location information stored in struct JournalFile.
2014-12-18 12:26:00 +01:00
Michal Schmidt
1eb6332d55 journal: simplify set_location()
set_location() is called from real_journal_next() when a winning entry
has been picked from among the candidates in journal files.

The location type is always set to LOCATION_DISCRETE. No need to pass
it as a parameter.
The per-JournalFile location information is already updated at this
point. No need for having the direction and offset here.
2014-12-18 12:20:25 +01:00
Michal Schmidt
6573ef05a3 journal: keep per-JournalFile location info during iteration
In next_beyond_location() when we find a candidate entry in a journal
file, save its location information in struct JournalFile.

The purpose of remembering the locations of candidate entries is to be
able to save work in the next iteration. This patch does only the
remembering part.

LOCATION_SEEK means the location identifies a candidate entry.
When a winner is picked from among candidates, it becomes
LOCATION_DISCRETE.
LOCATION_TAIL here signifies we've iterated the file to the end (or the
beginning in the case of reversed direction).
2014-12-18 12:17:20 +01:00
Michal Schmidt
1fc605b0e1 journal: abstract the resetting of JournalFile's location 2014-12-18 11:56:19 +01:00
Michal Schmidt
99cc7653a8 journal: move definition of LocationType to journal-file.h
In preparation for individual JournalFiles maintaining a location
of their own.
2014-12-18 11:53:39 +01:00
Michal Schmidt
8a2bd0a365 Revert "journal: optimize iteration: skip whole files behind current location"
This reverts commit b7c88ab8cc.

This optimization will be made redundant by the following patches.
2014-12-18 11:53:39 +01:00
Michal Schmidt
0633cb5206 Revert "journal: optimize iteration: skip files that cannot improve current candidate entry"
This reverts commit f8b5a3b75f.

This optimization will be made redundant by the following patches.
2014-12-18 11:53:39 +01:00
Michal Schmidt
14499361a5 journal: delete unused function journal_file_skip_entry()
Its only caller is a test.
2014-12-18 11:53:08 +01:00
Michal Schmidt
ae2adbcd09 journal: delete unused function journal_file_move_to_entry_by_offset() 2014-12-18 11:47:13 +01:00
Zbigniew Jędrzejewski-Szmek
ee05e7795b core: use raw_clone instead of fork in signal handler
fork() is not async-signal-safe and calling it from the signal handler
could result in a deadlock when at_fork() handlers are called. Using
the raw clone() syscall sidesteps that problem.

The tricky part is that raise() does not work, since getpid() does not
work. Add raw_getpid() to get the real pid, and use kill() instead of
raise().

https://bugs.freedesktop.org/show_bug.cgi?id=86604
2014-12-18 00:52:41 -05:00
Zbigniew Jędrzejewski-Szmek
503dbda6d9 test-unit-file: add test for semicolon escaping
https://bugs.freedesktop.org/show_bug.cgi?id=87393
2014-12-18 00:52:41 -05:00
tomsod-m ya ru
3851c51ad1 load-fragment: properly unescape \;
https://bugs.freedesktop.org/show_bug.cgi?id=87393
2014-12-17 23:01:38 -05:00