unix: add Linux blkpg_ioctl_arg and blkpg_partition types
For manipulating Linux partitions with the BLKPG ioctl.
Change-Id: I2196038ccfc39ecd6926817c3b310d0837220095
Reviewed-on: https://go-review.googlesource.com/125642
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/unix/linux/types.go b/unix/linux/types.go
index aa2553c..e237fad 100644
--- a/unix/linux/types.go
+++ b/unix/linux/types.go
@@ -73,6 +73,7 @@
#include <linux/socket.h>
#include <linux/hdreg.h>
#include <linux/rtc.h>
+#include <linux/blkpg.h>
// abi/abi.h generated by mkall.go.
#include "abi/abi.h"
@@ -312,6 +313,15 @@
char f_fpack[6];
};
+// my_blkpg_partition is blkpg_partition with unsigned devname & volname.
+struct my_blkpg_partition {
+ long long start;
+ long long length;
+ int pno;
+ unsigned char devname[BLKPG_DEVNAMELTH];
+ unsigned char volname[BLKPG_VOLNAMELTH];
+};
+
*/
import "C"
@@ -1516,3 +1526,16 @@
type RTCWkAlrm C.struct_rtc_wkalrm
type RTCPLLInfo C.struct_rtc_pll_info
+
+// BLKPG ioctl:
+
+type BlkpgIoctlArg C.struct_blkpg_ioctl_arg
+
+type BlkpgPartition C.struct_my_blkpg_partition
+
+const (
+ BLKPG = C.BLKPG
+ BLKPG_ADD_PARTITION = C.BLKPG_ADD_PARTITION
+ BLKPG_DEL_PARTITION = C.BLKPG_DEL_PARTITION
+ BLKPG_RESIZE_PARTITION = C.BLKPG_RESIZE_PARTITION
+)
diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go
index 4c25003..9d6dd8a 100644
--- a/unix/ztypes_linux_386.go
+++ b/unix/ztypes_linux_386.go
@@ -1852,3 +1852,25 @@
Negmult int32
Clock int32
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+}
+
+const (
+ BLKPG = 0x1269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go
index 2e4d709..31cde89 100644
--- a/unix/ztypes_linux_amd64.go
+++ b/unix/ztypes_linux_amd64.go
@@ -1872,3 +1872,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x1269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go
index bf38e5e..5d17fee 100644
--- a/unix/ztypes_linux_arm.go
+++ b/unix/ztypes_linux_arm.go
@@ -1841,3 +1841,26 @@
Negmult int32
Clock int32
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x1269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go
index 972c1b8..a4eaf10 100644
--- a/unix/ztypes_linux_arm64.go
+++ b/unix/ztypes_linux_arm64.go
@@ -1851,3 +1851,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x1269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go
index 783e70e..614d985 100644
--- a/unix/ztypes_linux_mips.go
+++ b/unix/ztypes_linux_mips.go
@@ -1846,3 +1846,26 @@
Negmult int32
Clock int32
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x20001269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go
index 5c6ea71..f609dea 100644
--- a/unix/ztypes_linux_mips64.go
+++ b/unix/ztypes_linux_mips64.go
@@ -1853,3 +1853,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x20001269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go
index 93effc8..a9cb3d2 100644
--- a/unix/ztypes_linux_mips64le.go
+++ b/unix/ztypes_linux_mips64le.go
@@ -1853,3 +1853,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x20001269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go
index cc5ca24..fcb28a1 100644
--- a/unix/ztypes_linux_mipsle.go
+++ b/unix/ztypes_linux_mipsle.go
@@ -1846,3 +1846,26 @@
Negmult int32
Clock int32
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x20001269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go
index 712f640..0b4066d 100644
--- a/unix/ztypes_linux_ppc64.go
+++ b/unix/ztypes_linux_ppc64.go
@@ -1861,3 +1861,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x20001269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go
index 1be4532..46ff733 100644
--- a/unix/ztypes_linux_ppc64le.go
+++ b/unix/ztypes_linux_ppc64le.go
@@ -1861,3 +1861,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x20001269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)
diff --git a/unix/ztypes_linux_s390x.go b/unix/ztypes_linux_s390x.go
index 932b655..973463d 100644
--- a/unix/ztypes_linux_s390x.go
+++ b/unix/ztypes_linux_s390x.go
@@ -1878,3 +1878,27 @@
Negmult int32
Clock int64
}
+
+type BlkpgIoctlArg struct {
+ Op int32
+ Flags int32
+ Datalen int32
+ _ [4]byte
+ Data *byte
+}
+
+type BlkpgPartition struct {
+ Start int64
+ Length int64
+ Pno int32
+ Devname [64]uint8
+ Volname [64]uint8
+ _ [4]byte
+}
+
+const (
+ BLKPG = 0x1269
+ BLKPG_ADD_PARTITION = 0x1
+ BLKPG_DEL_PARTITION = 0x2
+ BLKPG_RESIZE_PARTITION = 0x3
+)