unix: add consts and structs for <mtd/mtd-user.h>
It would be convenient to have MTD user space consts and structs
in the package.
Checked that the regexes in unix/mkerrors.sh are not too general,
and that all the defined constants in <mtd/mtd-user.h> are included
in the generated code.
Checked that all structs and enums added in unix/linux/types.go
are complete.
Fixes golang/go#46063
Change-Id: I190ac290f3f32a4f817cc7506df0dddb24d881b8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/318211
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/unix/linux/types.go b/unix/linux/types.go
index ebc7aec..a6a9952 100644
--- a/unix/linux/types.go
+++ b/unix/linux/types.go
@@ -130,6 +130,8 @@
#include <linux/watchdog.h>
#include <linux/vm_sockets.h>
+#include <mtd/mtd-user.h>
+
// abi/abi.h generated by mkall.go.
#include "abi/abi.h"
@@ -3672,3 +3674,33 @@
NLMSGERR_ATTR_OFFS = C.NLMSGERR_ATTR_OFFS
NLMSGERR_ATTR_COOKIE = C.NLMSGERR_ATTR_COOKIE
)
+
+// MTD
+
+type (
+ EraseInfo C.struct_erase_info_user
+ EraseInfo64 C.struct_erase_info_user64
+ MtdOobBuf C.struct_mtd_oob_buf
+ MtdOobBuf64 C.struct_mtd_oob_buf64
+ MtdWriteReq C.struct_mtd_write_req
+ MtdInfo C.struct_mtd_info_user
+ RegionInfo C.struct_region_info_user
+ OtpInfo C.struct_otp_info
+ NandOobinfo C.struct_nand_oobinfo
+ NandOobfree C.struct_nand_oobfree
+ NandEcclayout C.struct_nand_ecclayout_user
+ MtdEccStats C.struct_mtd_ecc_stats
+)
+
+const (
+ MTD_OPS_PLACE_OOB = C.MTD_OPS_PLACE_OOB
+ MTD_OPS_AUTO_OOB = C.MTD_OPS_AUTO_OOB
+ MTD_OPS_RAW = C.MTD_OPS_RAW
+)
+
+const (
+ MTD_FILE_MODE_NORMAL = C.MTD_FILE_MODE_NORMAL
+ MTD_FILE_MODE_OTP_FACTORY = C.MTD_FILE_MODE_OTP_FACTORY
+ MTD_FILE_MODE_OTP_USER = C.MTD_FILE_MODE_OTP_USER
+ MTD_FILE_MODE_RAW = C.MTD_FILE_MODE_RAW
+)
diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh
index 007358a..2dd9013 100755
--- a/unix/mkerrors.sh
+++ b/unix/mkerrors.sh
@@ -258,6 +258,7 @@
#include <linux/watchdog.h>
#include <mtd/ubi-user.h>
+#include <mtd/mtd-user.h>
#include <net/route.h>
#if defined(__sparc__)
@@ -593,6 +594,9 @@
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
$2 ~ /^_?HIDIOC/ ||
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
+ $2 ~ /^MTD_/ ||
+ $2 ~ /^OTP/ ||
+ $2 ~ /^MEM/ ||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next}
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go
index 47572aa..4e4583b 100644
--- a/unix/zerrors_linux.go
+++ b/unix/zerrors_linux.go
@@ -1406,6 +1406,10 @@
MCAST_LEAVE_SOURCE_GROUP = 0x2f
MCAST_MSFILTER = 0x30
MCAST_UNBLOCK_SOURCE = 0x2c
+ MEMGETREGIONINFO = 0xc0104d08
+ MEMREADOOB64 = 0xc0184d16
+ MEMWRITE = 0xc0304d18
+ MEMWRITEOOB64 = 0xc0184d15
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
@@ -1494,7 +1498,35 @@
MS_SYNCHRONOUS = 0x10
MS_UNBINDABLE = 0x20000
MS_VERBOSE = 0x8000
+ MTD_ABSENT = 0x0
+ MTD_BIT_WRITEABLE = 0x800
+ MTD_CAP_NANDFLASH = 0x400
+ MTD_CAP_NORFLASH = 0xc00
+ MTD_CAP_NVRAM = 0x1c00
+ MTD_CAP_RAM = 0x1c00
+ MTD_CAP_ROM = 0x0
+ MTD_DATAFLASH = 0x6
MTD_INODE_FS_MAGIC = 0x11307854
+ MTD_MAX_ECCPOS_ENTRIES = 0x40
+ MTD_MAX_OOBFREE_ENTRIES = 0x8
+ MTD_MLCNANDFLASH = 0x8
+ MTD_NANDECC_AUTOPLACE = 0x2
+ MTD_NANDECC_AUTOPL_USR = 0x4
+ MTD_NANDECC_OFF = 0x0
+ MTD_NANDECC_PLACE = 0x1
+ MTD_NANDECC_PLACEONLY = 0x3
+ MTD_NANDFLASH = 0x4
+ MTD_NORFLASH = 0x3
+ MTD_NO_ERASE = 0x1000
+ MTD_OTP_FACTORY = 0x1
+ MTD_OTP_OFF = 0x0
+ MTD_OTP_USER = 0x2
+ MTD_POWERUP_LOCK = 0x2000
+ MTD_RAM = 0x1
+ MTD_ROM = 0x2
+ MTD_SLC_ON_MLC_EMULATION = 0x4000
+ MTD_UBIVOLUME = 0x7
+ MTD_WRITEABLE = 0x400
NAME_MAX = 0xff
NCP_SUPER_MAGIC = 0x564c
NETLINK_ADD_MEMBERSHIP = 0x1
diff --git a/unix/zerrors_linux_386.go b/unix/zerrors_linux_386.go
index e91a1a9..33b401d 100644
--- a/unix/zerrors_linux_386.go
+++ b/unix/zerrors_linux_386.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x81484d11
+ ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -123,6 +125,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x40084d02
+ MEMERASE64 = 0x40104d14
+ MEMGETBADBLOCK = 0x40084d0b
+ MEMGETINFO = 0x80204d01
+ MEMGETOOBSEL = 0x80c84d0a
+ MEMGETREGIONCOUNT = 0x80044d07
+ MEMISLOCKED = 0x80084d17
+ MEMLOCK = 0x40084d05
+ MEMREADOOB = 0xc00c4d04
+ MEMSETBADBLOCK = 0x40084d0c
+ MEMUNLOCK = 0x40084d06
+ MEMWRITEOOB = 0xc00c4d03
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@@ -132,6 +146,10 @@
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x40044d0e
+ OTPGETREGIONINFO = 0x400c4d0f
+ OTPLOCK = 0x800c4d10
+ OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_amd64.go b/unix/zerrors_linux_amd64.go
index a9cbac6..aec8754 100644
--- a/unix/zerrors_linux_amd64.go
+++ b/unix/zerrors_linux_amd64.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x81484d11
+ ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -123,6 +125,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x40084d02
+ MEMERASE64 = 0x40104d14
+ MEMGETBADBLOCK = 0x40084d0b
+ MEMGETINFO = 0x80204d01
+ MEMGETOOBSEL = 0x80c84d0a
+ MEMGETREGIONCOUNT = 0x80044d07
+ MEMISLOCKED = 0x80084d17
+ MEMLOCK = 0x40084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x40084d0c
+ MEMUNLOCK = 0x40084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -132,6 +146,10 @@
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x40044d0e
+ OTPGETREGIONINFO = 0x400c4d0f
+ OTPLOCK = 0x800c4d10
+ OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_arm.go b/unix/zerrors_linux_arm.go
index d74f3c1..e96fc5c 100644
--- a/unix/zerrors_linux_arm.go
+++ b/unix/zerrors_linux_arm.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x81484d11
+ ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x40084d02
+ MEMERASE64 = 0x40104d14
+ MEMGETBADBLOCK = 0x40084d0b
+ MEMGETINFO = 0x80204d01
+ MEMGETOOBSEL = 0x80c84d0a
+ MEMGETREGIONCOUNT = 0x80044d07
+ MEMISLOCKED = 0x80084d17
+ MEMLOCK = 0x40084d05
+ MEMREADOOB = 0xc00c4d04
+ MEMSETBADBLOCK = 0x40084d0c
+ MEMUNLOCK = 0x40084d06
+ MEMWRITEOOB = 0xc00c4d03
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x40044d0e
+ OTPGETREGIONINFO = 0x400c4d0f
+ OTPLOCK = 0x800c4d10
+ OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_arm64.go b/unix/zerrors_linux_arm64.go
index e153899..c429c48 100644
--- a/unix/zerrors_linux_arm64.go
+++ b/unix/zerrors_linux_arm64.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x81484d11
+ ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -124,6 +126,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x40084d02
+ MEMERASE64 = 0x40104d14
+ MEMGETBADBLOCK = 0x40084d0b
+ MEMGETINFO = 0x80204d01
+ MEMGETOOBSEL = 0x80c84d0a
+ MEMGETREGIONCOUNT = 0x80044d07
+ MEMISLOCKED = 0x80084d17
+ MEMLOCK = 0x40084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x40084d0c
+ MEMUNLOCK = 0x40084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -133,6 +147,10 @@
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x40044d0e
+ OTPGETREGIONINFO = 0x400c4d0f
+ OTPLOCK = 0x800c4d10
+ OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_mips.go b/unix/zerrors_linux_mips.go
index 5e8e71f..aaa4871 100644
--- a/unix/zerrors_linux_mips.go
+++ b/unix/zerrors_linux_mips.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc00c4d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc00c4d03
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_mips64.go b/unix/zerrors_linux_mips64.go
index e670ee1..6481641 100644
--- a/unix/zerrors_linux_mips64.go
+++ b/unix/zerrors_linux_mips64.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_mips64le.go b/unix/zerrors_linux_mips64le.go
index dd11eac..a5a65d0 100644
--- a/unix/zerrors_linux_mips64le.go
+++ b/unix/zerrors_linux_mips64le.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_mipsle.go b/unix/zerrors_linux_mipsle.go
index a0a5b22..88ce266 100644
--- a/unix/zerrors_linux_mipsle.go
+++ b/unix/zerrors_linux_mipsle.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc00c4d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc00c4d03
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_ppc.go b/unix/zerrors_linux_ppc.go
index d9530e5..98f1ef7 100644
--- a/unix/zerrors_linux_ppc.go
+++ b/unix/zerrors_linux_ppc.go
@@ -60,6 +60,8 @@
CS8 = 0x300
CSIZE = 0x300
CSTOPB = 0x400
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc00c4d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc00c4d03
NFDBITS = 0x20
NL2 = 0x200
NL3 = 0x300
@@ -132,6 +146,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x4
ONLCR = 0x2
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_ppc64.go b/unix/zerrors_linux_ppc64.go
index e60102f..6b29a58 100644
--- a/unix/zerrors_linux_ppc64.go
+++ b/unix/zerrors_linux_ppc64.go
@@ -60,6 +60,8 @@
CS8 = 0x300
CSIZE = 0x300
CSTOPB = 0x400
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NL2 = 0x200
NL3 = 0x300
@@ -132,6 +146,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x4
ONLCR = 0x2
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_ppc64le.go b/unix/zerrors_linux_ppc64le.go
index 838ff4e..f60ca86 100644
--- a/unix/zerrors_linux_ppc64le.go
+++ b/unix/zerrors_linux_ppc64le.go
@@ -60,6 +60,8 @@
CS8 = 0x300
CSIZE = 0x300
CSTOPB = 0x400
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NL2 = 0x200
NL3 = 0x300
@@ -132,6 +146,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x4
ONLCR = 0x2
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_riscv64.go b/unix/zerrors_linux_riscv64.go
index 7cc98f0..86fdffe 100644
--- a/unix/zerrors_linux_riscv64.go
+++ b/unix/zerrors_linux_riscv64.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x81484d11
+ ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x40084d02
+ MEMERASE64 = 0x40104d14
+ MEMGETBADBLOCK = 0x40084d0b
+ MEMGETINFO = 0x80204d01
+ MEMGETOOBSEL = 0x80c84d0a
+ MEMGETREGIONCOUNT = 0x80044d07
+ MEMISLOCKED = 0x80084d17
+ MEMLOCK = 0x40084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x40084d0c
+ MEMUNLOCK = 0x40084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x40044d0e
+ OTPGETREGIONINFO = 0x400c4d0f
+ OTPLOCK = 0x800c4d10
+ OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_s390x.go b/unix/zerrors_linux_s390x.go
index 6d30e6f..de67791 100644
--- a/unix/zerrors_linux_s390x.go
+++ b/unix/zerrors_linux_s390x.go
@@ -60,6 +60,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x81484d11
+ ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -121,6 +123,18 @@
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
+ MEMERASE = 0x40084d02
+ MEMERASE64 = 0x40104d14
+ MEMGETBADBLOCK = 0x40084d0b
+ MEMGETINFO = 0x80204d01
+ MEMGETOOBSEL = 0x80c84d0a
+ MEMGETREGIONCOUNT = 0x80044d07
+ MEMISLOCKED = 0x80084d17
+ MEMLOCK = 0x40084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x40084d0c
+ MEMUNLOCK = 0x40084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -130,6 +144,10 @@
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x40044d0e
+ OTPGETREGIONINFO = 0x400c4d0f
+ OTPLOCK = 0x800c4d10
+ OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
diff --git a/unix/zerrors_linux_sparc64.go b/unix/zerrors_linux_sparc64.go
index d5e2dc9..9ebc9d6 100644
--- a/unix/zerrors_linux_sparc64.go
+++ b/unix/zerrors_linux_sparc64.go
@@ -63,6 +63,8 @@
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
+ ECCGETLAYOUT = 0x41484d11
+ ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@@ -126,6 +128,18 @@
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
+ MEMERASE = 0x80084d02
+ MEMERASE64 = 0x80104d14
+ MEMGETBADBLOCK = 0x80084d0b
+ MEMGETINFO = 0x40204d01
+ MEMGETOOBSEL = 0x40c84d0a
+ MEMGETREGIONCOUNT = 0x40044d07
+ MEMISLOCKED = 0x40084d17
+ MEMLOCK = 0x80084d05
+ MEMREADOOB = 0xc0104d04
+ MEMSETBADBLOCK = 0x80084d0c
+ MEMUNLOCK = 0x80084d06
+ MEMWRITEOOB = 0xc0104d03
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@@ -135,6 +149,10 @@
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
+ OTPGETREGIONCOUNT = 0x80044d0e
+ OTPGETREGIONINFO = 0x800c4d0f
+ OTPLOCK = 0x400c4d10
+ OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x40
O_CLOEXEC = 0x400000
diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go
index 0873235..c9b2c9a 100644
--- a/unix/ztypes_linux.go
+++ b/unix/ztypes_linux.go
@@ -3742,3 +3742,89 @@
NLMSGERR_ATTR_OFFS = 0x2
NLMSGERR_ATTR_COOKIE = 0x3
)
+
+type (
+ EraseInfo struct {
+ Start uint32
+ Length uint32
+ }
+ EraseInfo64 struct {
+ Start uint64
+ Length uint64
+ }
+ MtdOobBuf struct {
+ Start uint32
+ Length uint32
+ Ptr *uint8
+ }
+ MtdOobBuf64 struct {
+ Start uint64
+ Pad uint32
+ Length uint32
+ Ptr uint64
+ }
+ MtdWriteReq struct {
+ Start uint64
+ Len uint64
+ Ooblen uint64
+ Data uint64
+ Oob uint64
+ Mode uint8
+ _ [7]uint8
+ }
+ MtdInfo struct {
+ Type uint8
+ Flags uint32
+ Size uint32
+ Erasesize uint32
+ Writesize uint32
+ Oobsize uint32
+ _ uint64
+ }
+ RegionInfo struct {
+ Offset uint32
+ Erasesize uint32
+ Numblocks uint32
+ Regionindex uint32
+ }
+ OtpInfo struct {
+ Start uint32
+ Length uint32
+ Locked uint32
+ }
+ NandOobinfo struct {
+ Useecc uint32
+ Eccbytes uint32
+ Oobfree [8][2]uint32
+ Eccpos [32]uint32
+ }
+ NandOobfree struct {
+ Offset uint32
+ Length uint32
+ }
+ NandEcclayout struct {
+ Eccbytes uint32
+ Eccpos [64]uint32
+ Oobavail uint32
+ Oobfree [8]NandOobfree
+ }
+ MtdEccStats struct {
+ Corrected uint32
+ Failed uint32
+ Badblocks uint32
+ Bbtblocks uint32
+ }
+)
+
+const (
+ MTD_OPS_PLACE_OOB = 0x0
+ MTD_OPS_AUTO_OOB = 0x1
+ MTD_OPS_RAW = 0x2
+)
+
+const (
+ MTD_FILE_MODE_NORMAL = 0x0
+ MTD_FILE_MODE_OTP_FACTORY = 0x1
+ MTD_FILE_MODE_OTP_USER = 0x2
+ MTD_FILE_MODE_RAW = 0x3
+)