diff options
author | Amarjargal <amarjargal16@gmail.com> | 2022-04-09 04:43:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 21:43:18 +0100 |
commit | d5e4e60bf2071cb46de559b2275e4190c2968927 (patch) | |
tree | 3db63ba346ae23f5d742fe5e751069c900142750 /src/machine/machined-dbus.c | |
parent | 11b957b59b24447c8ac20d4fef281f4313510fe1 (diff) | |
download | systemd-d5e4e60bf2071cb46de559b2275e4190c2968927.tar.gz |
machine: update to use new-style sd-bus macros (#23012)
* machine: update to use new-style sd-bus macros
Replace old SD_BUS_METHOD_WITH_NAMES and SD_BUS_SIGNAL_WITH_NAMES macros to
the new SD_BUS_METHOD_WITH_ARGS and SD_BUS_SIGNAL_WITH_ARGS macros.
Meson test, mkosi test image and running machinectl after build returned
no error. But since I don't have any virtual machines or containers, I'm not
sure how to test the changes thoroughly.
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 492 |
1 files changed, 188 insertions, 304 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index ee9ad99255..865d8400e8 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -1014,310 +1014,194 @@ const sd_bus_vtable manager_vtable[] = { SD_BUS_PROPERTY("PoolUsage", "t", property_get_pool_usage, 0, 0), SD_BUS_PROPERTY("PoolLimit", "t", property_get_pool_limit, 0, 0), - SD_BUS_METHOD_WITH_NAMES("GetMachine", - "s", - SD_BUS_PARAM(name), - "o", - SD_BUS_PARAM(machine), - method_get_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetImage", - "s", - SD_BUS_PARAM(name), - "o", - SD_BUS_PARAM(image), - method_get_image, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetMachineByPID", - "u", - SD_BUS_PARAM(pid), - "o", - SD_BUS_PARAM(machine), - method_get_machine_by_pid, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("ListMachines", - NULL,, - "a(ssso)", - SD_BUS_PARAM(machines), - method_list_machines, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("ListImages", - NULL,, - "a(ssbttto)", - SD_BUS_PARAM(images), - method_list_images, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("CreateMachine", - "sayssusa(sv)", - SD_BUS_PARAM(name) - SD_BUS_PARAM(id) - SD_BUS_PARAM(service) - SD_BUS_PARAM(class) - SD_BUS_PARAM(leader) - SD_BUS_PARAM(root_directory) - SD_BUS_PARAM(scope_properties), - "o", - SD_BUS_PARAM(path), - method_create_machine, 0), - SD_BUS_METHOD_WITH_NAMES("CreateMachineWithNetwork", - "sayssusaia(sv)", - SD_BUS_PARAM(name) - SD_BUS_PARAM(id) - SD_BUS_PARAM(service) - SD_BUS_PARAM(class) - SD_BUS_PARAM(leader) - SD_BUS_PARAM(root_directory) - SD_BUS_PARAM(ifindices) - SD_BUS_PARAM(scope_properties), - "o", - SD_BUS_PARAM(path), - method_create_machine_with_network, 0), - SD_BUS_METHOD_WITH_NAMES("RegisterMachine", - "sayssus", - SD_BUS_PARAM(name) - SD_BUS_PARAM(id) - SD_BUS_PARAM(service) - SD_BUS_PARAM(class) - SD_BUS_PARAM(leader) - SD_BUS_PARAM(root_directory), - "o", - SD_BUS_PARAM(path), - method_register_machine, 0), - SD_BUS_METHOD_WITH_NAMES("RegisterMachineWithNetwork", - "sayssusai", - SD_BUS_PARAM(name) - SD_BUS_PARAM(id) - SD_BUS_PARAM(service) - SD_BUS_PARAM(class) - SD_BUS_PARAM(leader) - SD_BUS_PARAM(root_directory) - SD_BUS_PARAM(ifindices), - "o", - SD_BUS_PARAM(path), - method_register_machine_with_network, 0), - SD_BUS_METHOD_WITH_NAMES("UnregisterMachine", - "s", - SD_BUS_PARAM(name), - NULL,, - method_unregister_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("TerminateMachine", - "s", - SD_BUS_PARAM(id), - NULL,, - method_terminate_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("KillMachine", - "ssi", - SD_BUS_PARAM(name) - SD_BUS_PARAM(who) - SD_BUS_PARAM(signal), - NULL,, - method_kill_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetMachineAddresses", - "s", - SD_BUS_PARAM(name), - "a(iay)", - SD_BUS_PARAM(addresses), - method_get_machine_addresses, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetMachineOSRelease", - "s", - SD_BUS_PARAM(name), - "a{ss}", - SD_BUS_PARAM(fields), - method_get_machine_os_release, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("OpenMachinePTY", - "s", - SD_BUS_PARAM(name), - "hs", - SD_BUS_PARAM(pty) - SD_BUS_PARAM(pty_path), - method_open_machine_pty, - 0), - SD_BUS_METHOD_WITH_NAMES("OpenMachineLogin", - "s", - SD_BUS_PARAM(name), - "hs", - SD_BUS_PARAM(pty) - SD_BUS_PARAM(pty_path), - method_open_machine_login, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("OpenMachineShell", - "sssasas", - SD_BUS_PARAM(name) - SD_BUS_PARAM(user) - SD_BUS_PARAM(path) - SD_BUS_PARAM(args) - SD_BUS_PARAM(environment), - "hs", - SD_BUS_PARAM(pty) - SD_BUS_PARAM(pty_path), - method_open_machine_shell, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("BindMountMachine", - "sssbb", - SD_BUS_PARAM(name) - SD_BUS_PARAM(source) - SD_BUS_PARAM(destination) - SD_BUS_PARAM(read_only) - SD_BUS_PARAM(mkdir), - NULL,, - method_bind_mount_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("CopyFromMachine", - "sss", - SD_BUS_PARAM(name) - SD_BUS_PARAM(source) - SD_BUS_PARAM(destination), - NULL,, - method_copy_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("CopyToMachine", - "sss", - SD_BUS_PARAM(name) - SD_BUS_PARAM(source) - SD_BUS_PARAM(destination), - NULL,, - method_copy_machine, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("OpenMachineRootDirectory", - "s", - SD_BUS_PARAM(name), - "h", - SD_BUS_PARAM(fd), - method_open_machine_root_directory, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetMachineUIDShift", - "s", - SD_BUS_PARAM(name), - "u", - SD_BUS_PARAM(shift), - method_get_machine_uid_shift, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("RemoveImage", - "s", - SD_BUS_PARAM(name), - NULL,, - method_remove_image, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("RenameImage", - "ss", - SD_BUS_PARAM(name) - SD_BUS_PARAM(new_name), - NULL,, - method_rename_image, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("CloneImage", - "ssb", - SD_BUS_PARAM(name) - SD_BUS_PARAM(new_name) - SD_BUS_PARAM(read_only), - NULL,, - method_clone_image, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("MarkImageReadOnly", - "sb", - SD_BUS_PARAM(name) - SD_BUS_PARAM(read_only), - NULL,, - method_mark_image_read_only, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetImageHostname", - "s", - SD_BUS_PARAM(name), - "s", - SD_BUS_PARAM(hostname), - method_get_image_hostname, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetImageMachineID", - "s", - SD_BUS_PARAM(name), - "ay", - SD_BUS_PARAM(id), - method_get_image_machine_id, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetImageMachineInfo", - "s", - SD_BUS_PARAM(name), - "a{ss}", - SD_BUS_PARAM(machine_info), - method_get_image_machine_info, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("GetImageOSRelease", - "s", - SD_BUS_PARAM(name), - "a{ss}", - SD_BUS_PARAM(os_release), - method_get_image_os_release, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("SetPoolLimit", - "t", - SD_BUS_PARAM(size), - NULL,, - method_set_pool_limit, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("SetImageLimit", - "st", - SD_BUS_PARAM(name) - SD_BUS_PARAM(size), - NULL,, - method_set_image_limit, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("CleanPool", - "s", - SD_BUS_PARAM(mode), - "a(st)", - SD_BUS_PARAM(images), - method_clean_pool, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("MapFromMachineUser", - "su", - SD_BUS_PARAM(name) - SD_BUS_PARAM(uid_inner), - "u", - SD_BUS_PARAM(uid_outer), - method_map_from_machine_user, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("MapToMachineUser", - "u", - SD_BUS_PARAM(uid_outer), - "sou", - SD_BUS_PARAM(machine_name) - SD_BUS_PARAM(machine_path) - SD_BUS_PARAM(uid_inner), - method_map_to_machine_user, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("MapFromMachineGroup", - "su", - SD_BUS_PARAM(name) - SD_BUS_PARAM(gid_inner), - "u", - SD_BUS_PARAM(gid_outer), - method_map_from_machine_group, - SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_NAMES("MapToMachineGroup", - "u", - SD_BUS_PARAM(gid_outer), - "sou", - SD_BUS_PARAM(machine_name) - SD_BUS_PARAM(machine_path) - SD_BUS_PARAM(gid_inner), - method_map_to_machine_group, - SD_BUS_VTABLE_UNPRIVILEGED), - - SD_BUS_SIGNAL_WITH_NAMES("MachineNew", - "so", - SD_BUS_PARAM(machine) - SD_BUS_PARAM(path), - 0), - SD_BUS_SIGNAL_WITH_NAMES("MachineRemoved", - "so", - SD_BUS_PARAM(machine) - SD_BUS_PARAM(path), - 0), + SD_BUS_METHOD_WITH_ARGS("GetMachine", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("o", machine), + method_get_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetImage", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("o", image), + method_get_image, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetMachineByPID", + SD_BUS_ARGS("u", pid), + SD_BUS_RESULT("o", machine), + method_get_machine_by_pid, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("ListMachines", + SD_BUS_NO_ARGS, + SD_BUS_RESULT("a(ssso)", machines), + method_list_machines, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("ListImages", + SD_BUS_NO_ARGS, + SD_BUS_RESULT("a(ssbttto)", images), + method_list_images, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("CreateMachine", + SD_BUS_ARGS("s", name, "ay", id, "s", service, "s", class, "u", leader, "s", root_directory, "a(sv)", scope_properties), + SD_BUS_RESULT("o", path), + method_create_machine, 0), + SD_BUS_METHOD_WITH_ARGS("CreateMachineWithNetwork", + SD_BUS_ARGS("s", name, "ay", id, "s", service, "s", class, "u", leader, "s", root_directory, "ai", ifindices, "a(sv)", scope_properties), + SD_BUS_RESULT("o", path), + method_create_machine_with_network, 0), + SD_BUS_METHOD_WITH_ARGS("RegisterMachine", + SD_BUS_ARGS("s", name, "ay", id, "s", service, "s", class, "u", leader, "s", root_directory), + SD_BUS_RESULT("o", path), + method_register_machine, 0), + SD_BUS_METHOD_WITH_ARGS("RegisterMachineWithNetwork", + SD_BUS_ARGS("s", name, "ay", id, "s", service, "s", class, "u", leader, "s", root_directory, "ai", ifindices), + SD_BUS_RESULT("o", path), + method_register_machine_with_network, 0), + SD_BUS_METHOD_WITH_ARGS("UnregisterMachine", + SD_BUS_ARGS("s", name), + SD_BUS_NO_RESULT, + method_unregister_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("TerminateMachine", + SD_BUS_ARGS("s", id), + SD_BUS_NO_RESULT, + method_terminate_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("KillMachine", + SD_BUS_ARGS("s", name, "s", who, "i", signal), + SD_BUS_NO_RESULT, + method_kill_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetMachineAddresses", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("a(iay)", addresses), + method_get_machine_addresses, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetMachineOSRelease", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("a{ss}", fields), + method_get_machine_os_release, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("OpenMachinePTY", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("h", pty, "s", pty_path), + method_open_machine_pty, + 0), + SD_BUS_METHOD_WITH_ARGS("OpenMachineLogin", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("h", pty, "s", pty_path), + method_open_machine_login, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("OpenMachineShell", + SD_BUS_ARGS("s", name, "s", user, "s", path, "as", args, "as", environment), + SD_BUS_RESULT("h", pty, "s", pty_path), + method_open_machine_shell, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("BindMountMachine", + SD_BUS_ARGS("s", name, "s", source, "s", destination, "b", read_only, "b", mkdir), + SD_BUS_NO_RESULT, + method_bind_mount_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("CopyFromMachine", + SD_BUS_ARGS("s", name, "s", source, "s", destination), + SD_BUS_NO_RESULT, + method_copy_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("CopyToMachine", + SD_BUS_ARGS("s", name, "s", source, "s", destination), + SD_BUS_NO_RESULT, + method_copy_machine, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("OpenMachineRootDirectory", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("h", fd), + method_open_machine_root_directory, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetMachineUIDShift", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("u", shift), + method_get_machine_uid_shift, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("RemoveImage", + SD_BUS_ARGS("s", name), + SD_BUS_NO_RESULT, + method_remove_image, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("RenameImage", + SD_BUS_ARGS("s", name, "s", new_name), + SD_BUS_NO_RESULT, + method_rename_image, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("CloneImage", + SD_BUS_ARGS("s", name, "s", new_name, "b", read_only), + SD_BUS_NO_RESULT, + method_clone_image, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("MarkImageReadOnly", + SD_BUS_ARGS("s", name, "b", read_only), + SD_BUS_NO_RESULT, + method_mark_image_read_only, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetImageHostname", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("s", hostname), + method_get_image_hostname, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetImageMachineID", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("ay", id), + method_get_image_machine_id, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetImageMachineInfo", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("a{ss}", machine_info), + method_get_image_machine_info, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("GetImageOSRelease", + SD_BUS_ARGS("s", name), + SD_BUS_RESULT("a{ss}", os_release), + method_get_image_os_release, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("SetPoolLimit", + SD_BUS_ARGS("t", size), + SD_BUS_NO_RESULT, + method_set_pool_limit, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("SetImageLimit", + SD_BUS_ARGS("s", name, "t", size), + SD_BUS_NO_RESULT, + method_set_image_limit, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("CleanPool", + SD_BUS_ARGS("s", mode), + SD_BUS_RESULT("a(st)",images), + method_clean_pool, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("MapFromMachineUser", + SD_BUS_ARGS("s", name, "u", uid_inner), + SD_BUS_RESULT("u", uid_outer), + method_map_from_machine_user, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("MapToMachineUser", + SD_BUS_ARGS("u", uid_outer), + SD_BUS_RESULT("s", machine_name, "o", machine_path, "u", uid_inner), + method_map_to_machine_user, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("MapFromMachineGroup", + SD_BUS_ARGS("s", name, "u", gid_inner), + SD_BUS_RESULT("u", gid_outer), + method_map_from_machine_group, + SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_ARGS("MapToMachineGroup", + SD_BUS_ARGS("u", gid_outer), + SD_BUS_RESULT("s", machine_name, "o", machine_path, "u", gid_inner), + method_map_to_machine_group, + SD_BUS_VTABLE_UNPRIVILEGED), + + SD_BUS_SIGNAL_WITH_ARGS("MachineNew", + SD_BUS_ARGS("s", machine, "o", path), + 0), + SD_BUS_SIGNAL_WITH_ARGS("MachineRemoved", + SD_BUS_ARGS("s", machine, "o", path), + 0), SD_BUS_VTABLE_END }; |