10f66f451Sopenharmony_ci/* partprobe.c - Tell the kernel about partition table changes 20f66f451Sopenharmony_ci * 30f66f451Sopenharmony_ci * Copyright 2014 Bertold Van den Bergh <vandenbergh@bertold.org> 40f66f451Sopenharmony_ci * 50f66f451Sopenharmony_ci * see http://man7.org/linux/man-pages/man8/partprobe.8.html 60f66f451Sopenharmony_ci 70f66f451Sopenharmony_ciUSE_PARTPROBE(NEWTOY(partprobe, "<1", TOYFLAG_SBIN)) 80f66f451Sopenharmony_ci 90f66f451Sopenharmony_ciconfig PARTPROBE 100f66f451Sopenharmony_ci bool "partprobe" 110f66f451Sopenharmony_ci default y 120f66f451Sopenharmony_ci help 130f66f451Sopenharmony_ci usage: partprobe DEVICE... 140f66f451Sopenharmony_ci 150f66f451Sopenharmony_ci Tell the kernel about partition table changes 160f66f451Sopenharmony_ci 170f66f451Sopenharmony_ci Ask the kernel to re-read the partition table on the specified devices. 180f66f451Sopenharmony_ci*/ 190f66f451Sopenharmony_ci 200f66f451Sopenharmony_ci#include "toys.h" 210f66f451Sopenharmony_ci 220f66f451Sopenharmony_cistatic void do_partprobe(int fd, char *name) 230f66f451Sopenharmony_ci{ 240f66f451Sopenharmony_ci if (ioctl(fd, BLKRRPART, 0)) perror_msg("ioctl failed"); 250f66f451Sopenharmony_ci} 260f66f451Sopenharmony_ci 270f66f451Sopenharmony_civoid partprobe_main(void) 280f66f451Sopenharmony_ci{ 290f66f451Sopenharmony_ci loopfiles(toys.optargs, do_partprobe); 300f66f451Sopenharmony_ci} 31