1 Star 0 Fork 98

misaka00251/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-systemctl-pretty-print-ExtensionImages-property.patch 3.66 KB
一键复制 编辑 原始数据 按行查看 历史
From c4967b69610a75375cdcaafc9a9816ffddaeec38 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@microsoft.com>
Date: Tue, 26 Oct 2021 22:55:30 +0100
Subject: [PATCH] systemctl: pretty-print ExtensionImages property
Complex type, so without explicit support 'systemctl show' just prints [unprintable]
(cherry picked from commit 60c16c5cf3458199646cbda9dfe7763b6ba8b62f)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/c4967b69610a75375cdcaafc9a9816ffddaeec38
---
src/systemctl/systemctl-show.c | 56 ++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c
index 1f524626bf..3bc9fd4920 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1694,6 +1694,62 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
return 1;
+ } else if (streq(name, "ExtensionImages")) {
+ _cleanup_free_ char *paths = NULL;
+
+ r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(sba(ss))");
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ for (;;) {
+ _cleanup_free_ char *str = NULL;
+ const char *source, *partition, *mount_options;
+ int ignore_enoent;
+
+ r = sd_bus_message_enter_container(m, 'r', "sba(ss)");
+ if (r < 0)
+ return bus_log_parse_error(r);
+ if (r == 0)
+ break;
+
+ r = sd_bus_message_read(m, "sb", &source, &ignore_enoent);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ str = strjoin(ignore_enoent ? "-" : "", source);
+ if (!str)
+ return log_oom();
+
+ r = sd_bus_message_enter_container(m, 'a', "(ss)");
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ while ((r = sd_bus_message_read(m, "(ss)", &partition, &mount_options)) > 0)
+ if (!strextend_with_separator(&str, ":", partition, mount_options))
+ return log_oom();
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ if (!strextend_with_separator(&paths, " ", str))
+ return log_oom();
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return bus_log_parse_error(r);
+ }
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ bus_print_property_value(name, expected_value, flags, paths);
+
+ return 1;
+
} else if (streq(name, "BPFProgram")) {
const char *a, *p;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/misaka00251/systemd.git
git@gitee.com:misaka00251/systemd.git
misaka00251
systemd
systemd
master

搜索帮助