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 
7 USE_PARTPROBE(NEWTOY(partprobe, "<1", TOYFLAG_SBIN))
8 
9 config 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 
do_partprobe(int fd,char * name)22 static void do_partprobe(int fd, char *name)
23 {
24   if (ioctl(fd, BLKRRPART, 0)) perror_msg("ioctl failed");
25 }
26 
partprobe_main(void)27 void partprobe_main(void)
28 {
29   loopfiles(toys.optargs, do_partprobe);
30 }
31