public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/3] Create separate .c file for include/tst_net.h
Date: Mon, 16 Mar 2020 17:33:55 +0100	[thread overview]
Message-ID: <20200316163355.GA8204@dell5510> (raw)
In-Reply-To: <20200316141842.GB26750@rei.lan>

Hi Martin, Cyril,

> > >> +int tst_bit_count(uint32_t i);
> > >> +int tst_mask2prefix(struct in_addr mask);
> > >> +int tst_ipv4_mask_to_int(const char *prefix);
> > >> +int tst_safe_atoi(const char *s, int *ret_i);
> > >> +int tst_get_prefix(const char *ip_str, int is_ipv6);
> > >> +void tst_get_in_addr(const char *ip_str, struct in_addr *ip);
> > >> +void tst_get_in6_addr(const char *ip_str, struct in6_addr *ip6);

> > > Do we need all of these exported in the public API?

> > > It looks to me like most of these shouldn't be exported at all.

> > I guess that's a question for Petr. I'll be happy to drop the functions
> > meant to be private from the .h file and make them static in the .c file.

> Let's do that, there is no point in exporting unused functions.
When I created tst_net.h, I thought functions would be used in other tests, as
they're general network functions. This is not true for tst_{brk,res}_comment()
macro, MAX_IPV{4,6}_PREFIX defintions and tst_safe_atoi() which are specific
tst_net_{iface,ip}_prefix.c and tst_net_vars.c. We should probably have separate
header (and probably source file) for these macros and for functions which
aren't needed (yet), which would be used just for tst_net_{iface,ip}_prefix.c
and tst_net_vars.c and not exported by API.

tst_safe_atoi() has confusing name, because this function does not lead to
tst_brk(), but uses tst_brk_comment() (it's a bit confusing, but not sure for
proper name).

But maybe you meant to have all of them as private (accessible by few C sources
which need them and export only these new functions Martin added in his second
commit.

Kind regards,
Petr

  reply	other threads:[~2020-03-16 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 12:55 [LTP] [PATCH v3 0/3] Increase bind() coverage - GH#538 Martin Doucha
2020-03-12 12:55 ` [LTP] [PATCH v3 1/3] Create separate .c file for include/tst_net.h Martin Doucha
2020-03-13 12:57   ` Cyril Hrubis
2020-03-13 14:50     ` Martin Doucha
2020-03-16 14:18       ` Cyril Hrubis
2020-03-16 16:33         ` Petr Vorel [this message]
2020-03-12 12:55 ` [LTP] [PATCH v3 2/3] Add socket address initialization functions to tst_net library Martin Doucha
2020-03-12 12:55 ` [LTP] [PATCH v3 3/3] Add connection tests for bind() Martin Doucha

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=20200316163355.GA8204@dell5510 \
    --to=pvorel@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