From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH RFC v2] lib: new tst_test field to save and restore proc|sys
Date: Thu, 1 Nov 2018 17:00:41 +0100 [thread overview]
Message-ID: <20181101160041.GA14734@rei.lan> (raw)
In-Reply-To: <3a4b56e5194eb853e882357826c335d416614c86.1539966340.git.jstancek@redhat.com>
Hi!
> diff --git a/include/tst_sys_conf.h b/include/tst_sys_conf.h
> new file mode 100644
> index 000000000000..ed558f3cc8fd
> --- /dev/null
> +++ b/include/tst_sys_conf.h
> @@ -0,0 +1,27 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + *
> + * Copyright (c) 2018 Jan Stancek <jstancek@redhat.com>
> + */
> +
> +#ifndef TST_SYS_CONF_H__
> +#define TST_SYS_CONF_H__
> +
> +struct tst_sys_conf {
> + char path[PATH_MAX];
> + char value[PATH_MAX];
> + struct tst_sys_conf *prev;
> + struct tst_sys_conf *next;
> +};
> +
> +#define SYS_CONF_HEAD_INIT(name) { .prev = &(name), .next = &(name) }
> +#define TST_SYS_CONF_INIT(name) \
> + struct tst_sys_conf name = SYS_CONF_HEAD_INIT(name)
Well we can use ordinary (single link) linked list unless we want to
delete from it I guess. Or is there a reason to have double linked one?
Also I suppose that we do not need explicit declaration for the root
pointer, there would be only one list in existence. I would just put one
static pointer into the tst_sys_conf.c.
Other than these minor things it looks very good.
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2018-11-01 16:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 16:25 [LTP] [PATCH RFC v2] lib: new tst_test field to save and restore proc|sys Jan Stancek
2018-11-01 16:00 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181101160041.GA14734@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox