view toys/other/partprobe.c @ 1539:3e85af1f7e22 draft

First batch of sed tests. Only good for TEST_HOST=1 at the moment because the test infrastructure itself depends on sed, so if an unfinished sed is in the $PATH it goes boing. But hey, corner cases! I have... more.
author Rob Landley <rob@landley.net>
date Wed, 29 Oct 2014 18:44:33 -0500
parents 5662f0664060
children
line wrap: on
line source

/* partprobe.c - Tell the kernel about partition table changes
 *
 * Copyright 2014 Bertold Van den Bergh <vandenbergh@bertold.org>
 *
 * see http://man7.org/linux/man-pages/man8/partprobe.8.html

USE_PARTPROBE(NEWTOY(partprobe, "<1", TOYFLAG_SBIN))

config PARTPROBE
  bool "partprobe"
  default y
  help
    usage: partprobe DEVICE...

    Tell the kernel about partition table changes

    Ask the kernel to re-read the partition table on the specified devices.
*/

#include "toys.h"

static void do_partprobe(int fd, char *name)
{
  if (ioctl(fd, BLKRRPART, 0)) perror_msg("ioctl failed");
}

void partprobe_main(void)
{
  loopfiles(toys.optargs, do_partprobe); 
}