Quoting Samuel Thibault (2015-04-20 04:17:53)
> Boot it, use all the default parameters, and just after partition
> reloading from the kernel (which prints the new partition layout), the
> system is completely frozen.

I created a program to reload the partition table.  That wasn't as
smooth as it should be, and I didn't manage to get it done in a posixy
way.  I wonder which component of d-i does that, and how, seeing that
we don't even define BLKRRPART and hence fdisk and friends don't do
that on the Hurd.

Anyhow, reloading the partition tables seems to work as expected.  I
don't think it's related.

Justus
#define _GNU_SOURCE
#include <error.h>
#include <errno.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <mach.h>
#include <device/device.h>

#ifndef BLKRRPART
#warning BLKRRPART undefined
/* Err, this doesn't yield the expected value :( */
//#define BLKRRPART  _IO(0x12,95)	/* re-read partition table */
#define BLKRRPART 0x125f
#endif

int
main (int argc, char **argv)
{
  error_t err;

#if 0
  /* goesnt :( */
  if (argc != 2)
    error (1, 0, "Usage: %s <path/to/device>", argv[0]);

  int fd;
  fd = open (argv[1], O_RDWR);
  if (fd < 0)
    error (1, errno, "%s", argv[1]);

  if (ioctl (fd, BLKRRPART) != 0)
    error (1, errno, "ioctl (%d, BLKRRPART)", fd);
  
  close (fd);
#else
  if (argc != 2)
    error (1, 0, "Usage: %s <device>", argv[0]);

  mach_port_t dev, device_master;
  err = get_privileged_ports (NULL, &device_master);
  if (err)
    error (1, err, "get_privileged_ports");
  err = device_open (device_master, D_READ, argv[1], &dev);
  if (err)
    error (1, err, "device_open");
  err = device_set_status (dev, BLKRRPART, 0, 0);
  if (err)
    error (1, err, "device_set_status");
#endif
  
  return 0;
}

Reply via email to