From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH RFC] lib: add helper funcs to save and restore /proc|sys content
Date: Fri, 19 Oct 2018 13:18:18 +0200 [thread overview]
Message-ID: <20181019111817.GA31934@rei> (raw)
In-Reply-To: <bc3a3f3599064b34d60a2f2f21c5cac578582a50.1539866505.git.jstancek@redhat.com>
Hi!
> To avoid adding specially crafted functions for every feature
> where we need to save/restore some proc/sys config, this patch
> introduces a struct (linked list) where user pushes files names
> whose values should be saved. These can be later restored in
> cleanup or during the test.
This is a great idea, but I guess that the user API could be even more
simplified.
I would go for an NULL terminated array of strings that could be passed
in the tst_test structure. Also that way the values would be restored in the
test library even after the test has crashed.
Something as:
static const char *save_restore[] = {
"/proc/sys/kernel/core_pattern",
"/proc/sys/kernel/numa_balancing",
NULL,
};
static struct tst_test test = {
...
.save_restore = save_restore,
};
What do you think?
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2018-10-19 11:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 12:46 [LTP] [PATCH RFC] lib: add helper funcs to save and restore /proc|sys content Jan Stancek
2018-10-19 11:18 ` Cyril Hrubis [this message]
2018-10-19 11:52 ` Jan Stancek
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=20181019111817.GA31934@rei \
--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