From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/5] kernel/uevent: Add uevent01
Date: Mon, 26 Aug 2019 13:47:43 +0200 [thread overview]
Message-ID: <20190826114743.GB15568@haruka> (raw)
In-Reply-To: <1566405322.3587.21.camel@suse.de>
Hi!
> > +
> > + dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
>
> Maybe it isn't worth to check if dev_num is a valid number.
Sure.
> > +
> > + snprintf(ev_msg, sizeof(ev_msg),
> > + "change@/devices/virtual/block/loop%i", dev_num);
> > +
> > + snprintf(ev_dev_path, sizeof(ev_dev_path),
> > + "DEVPATH=/devices/virtual/block/loop%i", dev_num);
> > +
> > + snprintf(ev_dev_minor, sizeof(ev_dev_minor), "MINOR=%i",
> > dev_num);
> > + snprintf(ev_dev_name, sizeof(ev_dev_name), "DEVNAME=loop%i",
> > dev_num);
> > +
> > + const struct uevent_desc *const uevents[] = {
> > + &desc,
> > + &desc,
> > + NULL
> > + };
> > +
> > + pid = SAFE_FORK();
> > + if (!pid) {
> > + fd = open_uevent_netlink();
> > + TST_CHECKPOINT_WAKE(0);
> > + wait_for_uevents(fd, uevents);
>
> For me it wasn't obvious that wait_for_uevents() does the exit(). Not
> sure if we should do the exit better here or name the function like
> exit_on_uevents().
I was just lazy, I guess that the cleanest solution would be to call the
exit here after the wait_for_uevents() call.
> > + }
> > +
> > + TST_CHECKPOINT_WAIT(0);
> > +
> > + generate_device_events(dev_path);
> > +
> > + wait_for_pid(pid);
> > +}
> > +
> > +static struct tst_test test = {
> > + .test_all = verify_uevent,
> > + .forks_child = 1,
> > + .needs_tmpdir = 1,
>
> Just curious, where do we need the tmpdir?
We are creating a disk image to be attached to the loop device in the
generate_device_events().
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2019-08-26 11:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 15:18 [LTP] [PATCH v1 0/5] Add basic test for uevent netlink socket Cyril Hrubis
2019-08-20 15:18 ` [LTP] [PATCH v2 1/5] lib/tst_device: Export more functions Cyril Hrubis
2019-08-22 9:31 ` Clemens Famulla-Conrad
2019-08-20 15:18 ` [LTP] [PATCH v2 2/5] kernel/uevent: Add uevent01 Cyril Hrubis
2019-08-21 16:35 ` Clemens Famulla-Conrad
2019-08-26 11:47 ` Cyril Hrubis [this message]
2019-08-20 15:18 ` [LTP] [PATCH v2 3/5] kernel/uevent: Add uevent02 Cyril Hrubis
2019-08-21 16:35 ` Clemens Famulla-Conrad
2019-08-26 11:45 ` Cyril Hrubis
2019-08-20 15:18 ` [LTP] [PATCH v2 4/5] libs/libltpuinput: Add uinput library Cyril Hrubis
2019-08-22 9:12 ` Clemens Famulla-Conrad
2019-08-20 15:18 ` [LTP] [PATCH v2 5/5] kernel/uevent: Add uevent03 Cyril Hrubis
2019-08-22 9:00 ` Clemens Famulla-Conrad
2019-08-26 13:55 ` Cyril Hrubis
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=20190826114743.GB15568@haruka \
--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 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.