xref: /third_party/toybox/toys/other/partprobe.c (revision 0f66f451)
1/* partprobe.c - Tell the kernel about partition table changes
2 *
3 * Copyright 2014 Bertold Van den Bergh <vandenbergh@bertold.org>
4 *
5 * see http://man7.org/linux/man-pages/man8/partprobe.8.html
6
7USE_PARTPROBE(NEWTOY(partprobe, "<1", TOYFLAG_SBIN))
8
9config PARTPROBE
10  bool "partprobe"
11  default y
12  help
13    usage: partprobe DEVICE...
14
15    Tell the kernel about partition table changes
16
17    Ask the kernel to re-read the partition table on the specified devices.
18*/
19
20#include "toys.h"
21
22static void do_partprobe(int fd, char *name)
23{
24  if (ioctl(fd, BLKRRPART, 0)) perror_msg("ioctl failed");
25}
26
27void partprobe_main(void)
28{
29  loopfiles(toys.optargs, do_partprobe);
30}
31