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>
This commit is contained in:
lhl2617
2021-05-21 20:33:32 +00:00
committed by Ian Lance Taylor
parent 6ca3eb03df
commit 0cec03c779
18 changed files with 406 additions and 0 deletions
+32
View File
@@ -130,6 +130,8 @@ struct termios2 {
#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 @@ const (
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
)