From e3f9388ec6dc0a0e173d25869369c5bd9c1974d2 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 24 Jul 2018 17:16:09 +0000 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- unix/linux/types.go | 23 +++++++++++++++++++++++ unix/ztypes_linux_386.go | 22 ++++++++++++++++++++++ unix/ztypes_linux_amd64.go | 24 ++++++++++++++++++++++++ unix/ztypes_linux_arm.go | 23 +++++++++++++++++++++++ unix/ztypes_linux_arm64.go | 24 ++++++++++++++++++++++++ unix/ztypes_linux_mips.go | 23 +++++++++++++++++++++++ unix/ztypes_linux_mips64.go | 24 ++++++++++++++++++++++++ unix/ztypes_linux_mips64le.go | 24 ++++++++++++++++++++++++ unix/ztypes_linux_mipsle.go | 23 +++++++++++++++++++++++ unix/ztypes_linux_ppc64.go | 24 ++++++++++++++++++++++++ unix/ztypes_linux_ppc64le.go | 24 ++++++++++++++++++++++++ unix/ztypes_linux_s390x.go | 24 ++++++++++++++++++++++++ 12 files changed, 282 insertions(+) diff --git a/unix/linux/types.go b/unix/linux/types.go index aa2553c2..e237fadf 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -73,6 +73,7 @@ package unix #include #include #include +#include // abi/abi.h generated by mkall.go. #include "abi/abi.h" @@ -312,6 +313,15 @@ struct ustat { 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 RTCTime C.struct_rtc_time 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 4c250033..9d6dd8af 100644 --- a/unix/ztypes_linux_386.go +++ b/unix/ztypes_linux_386.go @@ -1852,3 +1852,25 @@ type RTCPLLInfo struct { 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 2e4d709b..31cde89d 100644 --- a/unix/ztypes_linux_amd64.go +++ b/unix/ztypes_linux_amd64.go @@ -1872,3 +1872,27 @@ type RTCPLLInfo struct { 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 bf38e5e2..5d17feee 100644 --- a/unix/ztypes_linux_arm.go +++ b/unix/ztypes_linux_arm.go @@ -1841,3 +1841,26 @@ type RTCPLLInfo struct { 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 972c1b87..a4eaf103 100644 --- a/unix/ztypes_linux_arm64.go +++ b/unix/ztypes_linux_arm64.go @@ -1851,3 +1851,27 @@ type RTCPLLInfo struct { 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 783e70e8..614d9856 100644 --- a/unix/ztypes_linux_mips.go +++ b/unix/ztypes_linux_mips.go @@ -1846,3 +1846,26 @@ type RTCPLLInfo struct { 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 5c6ea719..f609deab 100644 --- a/unix/ztypes_linux_mips64.go +++ b/unix/ztypes_linux_mips64.go @@ -1853,3 +1853,27 @@ type RTCPLLInfo struct { 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 93effc8e..a9cb3d27 100644 --- a/unix/ztypes_linux_mips64le.go +++ b/unix/ztypes_linux_mips64le.go @@ -1853,3 +1853,27 @@ type RTCPLLInfo struct { 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 cc5ca242..fcb28a1b 100644 --- a/unix/ztypes_linux_mipsle.go +++ b/unix/ztypes_linux_mipsle.go @@ -1846,3 +1846,26 @@ type RTCPLLInfo struct { 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 712f6402..0b4066d2 100644 --- a/unix/ztypes_linux_ppc64.go +++ b/unix/ztypes_linux_ppc64.go @@ -1861,3 +1861,27 @@ type RTCPLLInfo struct { 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 1be45320..46ff7330 100644 --- a/unix/ztypes_linux_ppc64le.go +++ b/unix/ztypes_linux_ppc64le.go @@ -1861,3 +1861,27 @@ type RTCPLLInfo struct { 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 932b655f..973463d2 100644 --- a/unix/ztypes_linux_s390x.go +++ b/unix/ztypes_linux_s390x.go @@ -1878,3 +1878,27 @@ type RTCPLLInfo struct { 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 +)