Mercurial > hg > toybox
annotate toys/other/partprobe.c @ 1736:5892daac85ab draft
Switch nsenter to default y.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 12 Mar 2015 15:34:03 -0500 |
parents | 5662f0664060 |
children |
rev | line source |
---|---|
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
1 /* partprobe.c - Tell the kernel about partition table changes |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
2 * |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
3 * Copyright 2014 Bertold Van den Bergh <vandenbergh@bertold.org> |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
4 * |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
5 * see http://man7.org/linux/man-pages/man8/partprobe.8.html |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
6 |
1328 | 7 USE_PARTPROBE(NEWTOY(partprobe, "<1", TOYFLAG_SBIN)) |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
8 |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
9 config PARTPROBE |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
10 bool "partprobe" |
1329 | 11 default y |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
12 help |
1328 | 13 usage: partprobe DEVICE... |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
14 |
1328 | 15 Tell the kernel about partition table changes |
16 | |
17 Ask the kernel to re-read the partition table on the specified devices. | |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
18 */ |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
19 |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
20 #include "toys.h" |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
21 |
1328 | 22 static void do_partprobe(int fd, char *name) |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
23 { |
1328 | 24 if (ioctl(fd, BLKRRPART, 0)) perror_msg("ioctl failed"); |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
25 } |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
26 |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
27 void partprobe_main(void) |
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
28 { |
1328 | 29 loopfiles(toys.optargs, do_partprobe); |
1317
94e143a0089f
I have attached a patch adding a program that allows re-reading the partition table. This is often used on embedded systems booting from SD/USB devices that need to resize partitions on first boot.
Bertold Van den Bergh <vandenbergh@bertold.org>
parents:
diff
changeset
|
30 } |