All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] save_restore: Check whether path is writable
Date: Wed, 26 Oct 2022 22:49:14 +0200	[thread overview]
Message-ID: <Y1mdSnShyka6Zva1@pevik> (raw)
In-Reply-To: <Y1kxMHBpEhb4SvUb@yuki>

> Hi!
> > > For optional path, if test can't read/write it (b/o of no root privileges),
> > > I think library shouldn't try to save it - then that would also skip
> > > attempt to restore it.

> > There are be two different kinds of optional paths, though:
> > 1) paths that sometimes don't exist but must be written to if they do
> > 2) paths that may be left alone if they exist and already contain the 
> > right value (otherwise TCONF)

> Alternatively we can cleanup the interface, we moved from a single
> string to a structure so we can add more fields, what about adding flags
> that would describe one single attribute of the file instead of
> clobbering several different characteristics of the file into a single
> character?

> We can then do something as:

> struct tst_save_restore {
> 	const char *path;
> 	const char *val;
> 	/* the test needs the file to exist -> TCONF on missing */
> 	int required:1;
> 	/* write the value even if the file already contains it */
> 	int rewrite:1;
> 	...
> };

> This makes the inteface orthogonal and much easier to reason about.

Sounds reasonable approach to me.
Martin, Jan, WDYT?

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2022-10-26 20:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 15:57 [LTP] [PATCH] save_restore: Check whether path is writable Martin Doucha
2022-10-21 20:34 ` Petr Vorel
2022-10-24  7:16   ` Jan Stancek
2022-10-25 16:13     ` Martin Doucha
2022-10-26 11:29       ` Jan Stancek
2022-10-26 13:10         ` Cyril Hrubis
2022-10-26 13:27         ` Martin Doucha
2022-10-26 13:08       ` Cyril Hrubis
2022-10-26 20:49         ` Petr Vorel [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=Y1mdSnShyka6Zva1@pevik \
    --to=pvorel@suse.cz \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.