Merge pull request #22825 from keszybz/assorted-cleanups

Assorted cleanups
This commit is contained in:
Yu Watanabe
2022-03-23 11:34:46 +09:00
committed by GitHub
5 changed files with 39 additions and 61 deletions
+15 -15
View File
@@ -2629,10 +2629,10 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>BootServerAddress=</varname></term>
<listitem>
<para>Takes an IPv4 address of the boot server used by e.g. PXE boot systems. When specified,
the address is set to the <literal>siaddr</literal> field of the DHCP message header. See
<ulink url="https://www.rfc-editor.org/rfc/rfc2131.html">RFC 2131</ulink> for more details.
Defaults to unset.</para>
<para>Takes an IPv4 address of the boot server used by e.g. PXE boot systems. When specified, this
address is sent in the <option>siaddr</option> field of the DHCP message header. See <ulink
url="https://www.rfc-editor.org/rfc/rfc2131.html">RFC 2131</ulink> for more details. Defaults to
unset.</para>
</listitem>
</varlistentry>
@@ -2640,13 +2640,13 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>BootServerName=</varname></term>
<listitem>
<para>Takes a name of the boot server used by e.g. PXE boot systems. When specified, the
server name is set to the DHCP option 66. See
<ulink url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details.
Defaults to unset.</para>
<para>Note that typically one of
<varname>BootServerName=</varname>/<varname>BootServerAddress=</varname> is sufficient to be
set, but both can be set too, if desired.</para>
<para>Takes a name of the boot server used by e.g. PXE boot systems. When specified, this name is
sent in the DHCP option 66 ("TFTP server name"). See <ulink
url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details. Defaults to
unset.</para>
<para>Note that typically setting one of <varname>BootServerName=</varname> or
<varname>BootServerAddress=</varname> is sufficient, but both can be set too, if desired.</para>
</listitem>
</varlistentry>
@@ -2654,10 +2654,10 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>BootFilename=</varname></term>
<listitem>
<para>Takes a path or URL to a file loaded by e.g. a PXE boot loader. The specified path is
set to the DHCP option 67. See
<ulink url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details.
Defaults to unset.</para>
<para>Takes a path or URL to a file loaded by e.g. a PXE boot loader. When specified, this path is
sent in the DHCP option 67 ("Bootfile name"). See <ulink
url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details. Defaults to
unset.</para>
</listitem>
</varlistentry>
+1 -1
View File
@@ -3,7 +3,7 @@
BEGIN{
print "static const char* const errno_names[] = { "
}
!/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ {
!/(EDEADLOCK|EWOULDBLOCK|ENOTSUP)/ {
printf " [%s] = \"%s\",\n", $1, $1
}
END{
+2 -2
View File
@@ -1163,12 +1163,12 @@ static int lock_image_fd(int image_fd, const char *ip) {
if (flock(image_fd, LOCK_EX|LOCK_NB) < 0) {
if (errno == EWOULDBLOCK)
if (errno == EAGAIN)
log_error_errno(errno, "Image file '%s' already locked, can't use.", ip);
else
log_error_errno(errno, "Failed to lock image file '%s': %m", ip);
return errno != EWOULDBLOCK ? -errno : -EADDRINUSE; /* Make error recognizable */
return errno != EAGAIN ? -errno : -EADDRINUSE; /* Make error recognizable */
}
log_info("Successfully locked image file '%s'.", ip);
+7 -10
View File
@@ -217,28 +217,26 @@ static int get_child_nodes(
const char *prefix,
struct node *n,
unsigned flags,
OrderedSet **_s,
OrderedSet **ret,
sd_bus_error *error) {
OrderedSet *s = NULL;
_cleanup_ordered_set_free_free_ OrderedSet *s = NULL;
int r;
assert(bus);
assert(prefix);
assert(n);
assert(_s);
assert(ret);
s = ordered_set_new(&string_hash_ops);
if (!s)
return -ENOMEM;
r = add_subtree_to_set(bus, prefix, n, flags, s, error);
if (r < 0) {
ordered_set_free_free(s);
if (r < 0)
return r;
}
*_s = s;
*ret = TAKE_PTR(s);
return 0;
}
@@ -1473,7 +1471,7 @@ int bus_process_object(sd_bus *bus, sd_bus_message *m) {
return 1;
}
static struct node *bus_node_allocate(sd_bus *bus, const char *path) {
static struct node* bus_node_allocate(sd_bus *bus, const char *path) {
struct node *n, *parent;
const char *e;
_cleanup_free_ char *s = NULL;
@@ -1499,8 +1497,7 @@ static struct node *bus_node_allocate(sd_bus *bus, const char *path) {
if (streq(path, "/"))
parent = NULL;
else {
e = strrchr(path, '/');
assert(e);
assert_se(e = strrchr(path, '/'));
p = strndupa_safe(path, MAX(1, e - path));
+14 -33
View File
@@ -4,58 +4,39 @@ from argparse import ArgumentParser
from pathlib import Path
from subprocess import run, PIPE
def extract_interfaces_xml(output_dir, executable):
list_interfaces_process = run(
proc = run(
args=[executable.absolute(), '--bus-introspect', 'list'],
stdout=PIPE,
check=True,
universal_newlines=True,
)
universal_newlines=True)
interfaces_lines = list_interfaces_process.stdout.splitlines()
interface_names = [x.split()[1] for x in interfaces_lines]
interface_names = (x.split()[1] for x in proc.stdout.splitlines())
for interface_name in interface_names:
interface_introspection_run = run(
proc = run(
args=[executable.absolute(), '--bus-introspect', interface_name],
stdout=PIPE,
check=True,
universal_newlines=True,
)
universal_newlines=True)
interface_file_name = output_dir / (interface_name + '.xml')
with open(interface_file_name, mode='w') as f:
f.write(interface_introspection_run.stdout)
interface_file_name.write_text(proc.stdout)
interface_file_name.chmod(0o644)
def iterate_executables(output_dir, executables):
output_dir.mkdir(mode=0o755, exist_ok=True)
for exe in executables:
extract_interfaces_xml(output_dir, exe)
def main():
parser = ArgumentParser()
parser.add_argument(
'output',
type=Path,
)
parser.add_argument(
'executables',
type=Path,
nargs='+',
)
parser.add_argument('output',
type=Path)
parser.add_argument('executables',
nargs='+',
type=Path)
args = parser.parse_args()
iterate_executables(args.output, args.executables)
args.output.mkdir(exist_ok=True)
for exe in args.executables:
extract_interfaces_xml(args.output, exe)
if __name__ == '__main__':
main()