summaryrefslogtreecommitdiff
path: root/src/mount
Commit message (Collapse)AuthorAgeFilesLines
* chase-symlinks: Rename chase_symlinks() to chase()Daan De Meyer2023-03-241-4/+4
| | | | | | | | | Chasing symlinks is a core function that's used in a lot of places so it deservers a less verbose names so let's rename it to chase() and chaseat(). We also slightly change the pattern used for the chaseat() helpers so we get chase_and_openat() and similar.
* basic: add RuntimeScope enumLennart Poettering2023-03-101-8/+9
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* mount-tool: port over basename() → path_extract_filename()Lennart Poettering2022-12-231-4/+13
|
* mount: use device enumerator to find matching loopback block deviceYu Watanabe2022-11-241-53/+33
| | | | No functional change, just refactoring.
* mount: split umount_by_device() into twoYu Watanabe2022-11-241-30/+37
| | | | | No functional change, just refactoring and preparation for later commits.
* mount: make acquire_mount_where_for_loop_dev() take sd-device objectYu Watanabe2022-11-241-11/+18
| | | | No functional change, just refactoring.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
|
* generator: skip fsck if fsck command is missingJonas Kümmerlin2022-09-301-1/+1
| | | | | | | | | | | This is useful for systems which don't have any fsck. We already skip emitting the fsck dependency when the fsck.$fstype helper is missing, but fstab-generator doesn't necessarily know the fstype when handling the root= parameter. Previously, systemd-fsck was started for these mounts and then exited immediately because it couldn't find the fsck.$fstype helper.
* dbus-wait-for-jobs: add extra_args to bus_wait_for_jobs_one()Luca Boccassi2021-12-301-3/+3
| | | | And pass it through to bus_wait_for_jobs()
* Define FOREACH_DIRENT through FOREACH_DIRENT_ALLZbigniew Jędrzejewski-Szmek2021-12-151-1/+0
| | | | As in the previous commit, 'de' is used as the iterator variable name.
* Merge pull request #20138 from keszybz/coding-style-variable-declsLuca Boccassi2021-11-051-1/+1
|\ | | | | A coding style tweak and checking of sd_notify() calls and voidification of pager_open()
| * Make pager_open() return voidZbigniew Jędrzejewski-Szmek2021-11-031-1/+1
| |
* | tree-wide: do not print hint about -M if -M is already usedZbigniew Jędrzejewski-Szmek2021-11-041-1/+1
|/ | | | | | | | (Or when -H is used, since -H and -M are incompatible.) Note that the slightly unusual form with separate boolean variables (hint_vars, hint_addr) instead of e.g. a const char* variable to hold the message, because this way we don't trigger the warning about non-literal format.
* basic: spit out chase_symlinks() from fs-util.[ch] → chase-symlinks.[ch]Lennart Poettering2021-10-051-0/+1
|
* run/mount/systemctl: don't fork off PolicyKit/ask-pw agent when in --user modeLennart Poettering2021-08-301-0/+3
| | | | | | | | When we are in --user mode there's no point in doing PolicyKit/ask-pw because both of these systems are only used by system-level services. Let's disable the two agents for that automaticlly hence. Prompted by: #20576
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-2/+2
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* dirent-util: use readdir_ensure_type() in readdir_no_dot() and FOREACH_DIRENT()Yu Watanabe2021-06-241-2/+0
|
* tree-wide: always drop unnecessary dot in pathYu Watanabe2021-05-281-3/+3
|
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)
* table: drop last SIZE_MAX from table_set_sort() and table_set_display()Yu Watanabe2021-03-051-1/+1
|
* tree-wide: use sd_device_new_from_stat_rdev() whereever appropriateLennart Poettering2021-02-221-3/+3
|
* mount-tool: sd_device_get_sysattr_value() returns 0 on successYu Watanabe2021-02-211-1/+1
|
* systemctl: don't search in the full argv[0] for the invocation nameLennart Poettering2021-02-201-2/+3
| | | | | | | | | | | | argv[0] might be prefixed by a path, and we shouldn't get confused by that. Hence provide a simple helper call that abstracts the checking away, which we can use everywhere, and expose the same behaviour, even if argv[0] is not set. (While we are at it, port all other multi-call binaries over to the new helper, too) Follow-up for: d41a9e4fc1e1bcdefc8d358da2744a97aac5820a
* tree-wide: use parse_boolean_argument() for variables with non-boolean typeZbigniew Jędrzejewski-Szmek2021-02-171-2/+2
| | | | | This still works nicely, but we need to assign the return value ourselves. As before, one nice effect is that error messages are uniform.
* tree-wide: add a helper to parse boolean optargZbigniew Jędrzejewski-Szmek2021-02-171-4/+3
| | | | | | | | | This nicely covers the case when optarg is optional. The same parser can be used when the option string passed to getopt_long() requires a parameter and when it doesn't. The error messages are made consistent. Also fixes a log error c&p in --crash-reboot message.
* tree-wide: use free_and_strdup_warn()Yu Watanabe2021-02-121-6/+9
|
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-5/+4
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-091-41/+37
|
* bus: use bus_log_connect_error to print error messagefangxiuning2020-07-211-1/+1
|
* tree-wide: use SYNTHETIC_ERRNO with log_device_* in more placesZbigniew Jędrzejewski-Szmek2020-07-161-8/+6
|
* table use table_log_print_error() instead of table_log_show_errorfangxiuning2020-07-081-1/+1
|
* shared: actually move all BusLocator related calls to bus-locator.cLennart Poettering2020-06-301-1/+1
|
* mount-tool: Replace fstype_is_{network,api_vfs} with fstype_is_blockdev_backedYmrDtnJu2020-06-081-2/+2
| | | | | Not every filesystem that is not a network filesystem and also not an API VFS filesystem has a corresponding block device.
* mount: switch to BusLocator-oriented helpersVito Caputo2020-05-071-21/+3
| | | | Mechanical substitution reducing some verbosity
* systemd: Fix busctl crash on aarch64 when setting output table formatAlin Popa2020-02-161-1/+1
| | | | | | | | The enum used for column names is integer type while table_set_display() is parsing arguments on size_t alignment which may result in assert in table_set_display() if the size between types missmatch. This patch cast the enums to size_t. It also fixes all other occurences for table_set_display() and table_set_sort().
* tree-wide: use table_log_add_error()Yu Watanabe2020-01-101-1/+1
|
* systemd-mount: add --full command line optionYu Watanabe2020-01-101-1/+11
|
* systemd-mount: add --no-legend command line optionYu Watanabe2020-01-091-0/+10
|
* systemd-mount: use format-table.[ch]Yu Watanabe2020-01-091-88/+16
|
* basic/fs-util: change CHASE_OPEN flag into a separate output parameterZbigniew Jędrzejewski-Szmek2019-10-241-3/+3
| | | | | | | | | | | | | chase_symlinks() would return negative on error, and either a non-negative status or a non-negative fd when CHASE_OPEN was given. This made the interface quite complicated, because dependning on the flags used, we would get two different "types" of return object. Coverity was always confused by this, and flagged every use of chase_symlinks() without CHASE_OPEN as a resource leak (because it would this that an fd is returned). This patch uses a saparate output parameter, so there is no confusion. (I think it is OK to have functions which return either an error or an fd. It's only returning *either* an fd or a non-fd that is confusing.)
* tree-wide: replace strjoin() with path_join()Yu Watanabe2019-06-211-4/+4
|
* systemd-mount: don't check for non-normalized WHAT for network FSKarel Zak2019-06-111-1/+2
| | | | | | | The WHAT string could be whatever for many filesystems. The common example are network filesystems. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1708996
* Merge pull request #12411 from keszybz/pr/12394Lennart Poettering2019-05-081-0/+1
|\ | | | | run: when emitting the calendarspec warning, use red
| * Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* | Add helper function for mnt_table_parse_{stream,mtab}Zbigniew Jędrzejewski-Szmek2019-04-231-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This wraps a few common steps. It is defined as inline function instead of in a .c file to avoid having a .c file. With a .c file, we would have three choices: - either link it into libshared, but then then libshared would have to be linked to libmount. - or compile the .c file into each target separately. This has the disdvantage that configuration of every target has to be updated and stuff will be compiled multiple times anyway, which is not too different from keeping this in the header file. - or create a new convenience library just for this. This also has the disadvantage that the every target would have to be updated, and a separate library for a 10 line function seems overkill. By keeping everything in a header file, we compile this a few times, but otherwise it's the least painful option. The compiler can optimize most of the function away, because it knows if 'source' is set or not.
* | mount-tool: use libmount to parse /proc/self/mountinfoZbigniew Jędrzejewski-Szmek2019-04-231-34/+29
|/ | | | | | | | | | | Same motivation as in other places: let's use a single logic to parse this. Use path_equal() to compare the path. A bug in error handling is fixed: if we failed after the GREEDY_REALLOC but before the line that sets the last item to NULL, we would jump to _cleanup_strv_free_ with the strv unterminated. Let's use GREEDY_REALLOC0 to avoid the issue.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+1
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* shared: split out code to wait for jobs to complet into its own source fileLennart Poettering2019-03-131-0/+1
| | | | | | | It's complex enough and quite a few functions. Let's hence split this out. No code change, just some rearranging of source files.
* util: split out sorting related calls to new sort-util.[ch]Lennart Poettering2019-03-131-1/+2
|