[sys] unix: update openbsd Statfs_t fields

7 views
Skip to first unread message

Kirill Kolyshkin (Gerrit)

unread,
May 18, 2022, 11:47:33 PM5/18/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Kirill Kolyshkin has uploaded this change for review.

View Change

unix: update openbsd Statfs_t fields

This changes some fields of openbsd Statfs_t from arrays of int8
to arrays of byte. This makes the types of those fields correspond to
the types used on most other BSD systems (Darwin, FreeBSD, NetBSD),
and simplifies the conversion to Go string.

Similar changes: CL 359674, CL 259903, CL 74331.

Note that while this patches mkpost.go, the end result is obtained by
manual editing of ztypes_openbsd_*.go files. The reasons for this are:

1. automatic regeneration (tried on openbsd 6.9 / amd64) brings in way
too many changes (5 files changed, 193 insertions, 45 deletions).

2. I could not figure out how to run openbsd on non-amd64.

Nevertheless, this change is sufficient, meaning if someone will
actually end up regenerating these (see e.g. CL 347649) after this
commit is merged, the fields will still be kept as arrays of byte.

Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
---
M unix/mkpost.go
M unix/ztypes_openbsd_386.go
M unix/ztypes_openbsd_amd64.go
M unix/ztypes_openbsd_arm.go
M unix/ztypes_openbsd_arm64.go
M unix/ztypes_openbsd_mips64.go
6 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/unix/mkpost.go b/unix/mkpost.go
index a275518..366b2d4 100644
--- a/unix/mkpost.go
+++ b/unix/mkpost.go
@@ -101,9 +101,9 @@
convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))

- // Convert [n]int8 to [n]byte in Statvfs_t members to simplify
+ // Convert [n]int8 to [n]byte in Statvfs_t and Statfs_t members to simplify
// conversion to string.
- convertStatvfsRegex := regexp.MustCompile(`((Fstype|Mnton|Mntfrom)name)(\s+)\[(\d+)\]int8`)
+ convertStatvfsRegex := regexp.MustCompile(`(([Ff]stype|[Mm]nton|[Mm]ntfrom)name|mntfromspec)(\s+)\[(\d+)\]int8`)
b = convertStatvfsRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))

// Convert []int8 to []byte in device mapper ioctl interface
diff --git a/unix/ztypes_openbsd_386.go b/unix/ztypes_openbsd_386.go
index baf5fe6..2ed718c 100644
--- a/unix/ztypes_openbsd_386.go
+++ b/unix/ztypes_openbsd_386.go
@@ -94,10 +94,10 @@
F_namemax uint32
F_owner uint32
F_ctime uint64
- F_fstypename [16]int8
- F_mntonname [90]int8
- F_mntfromname [90]int8
- F_mntfromspec [90]int8
+ F_fstypename [16]byte
+ F_mntonname [90]byte
+ F_mntfromname [90]byte
+ F_mntfromspec [90]byte
Pad_cgo_0 [2]byte
Mount_info [160]byte
}
diff --git a/unix/ztypes_openbsd_amd64.go b/unix/ztypes_openbsd_amd64.go
index e21ae8e..b4fb97e 100644
--- a/unix/ztypes_openbsd_amd64.go
+++ b/unix/ztypes_openbsd_amd64.go
@@ -96,10 +96,10 @@
F_namemax uint32
F_owner uint32
F_ctime uint64
- F_fstypename [16]int8
- F_mntonname [90]int8
- F_mntfromname [90]int8
- F_mntfromspec [90]int8
+ F_fstypename [16]byte
+ F_mntonname [90]byte
+ F_mntfromname [90]byte
+ F_mntfromspec [90]byte
_ [2]byte
Mount_info [160]byte
}
diff --git a/unix/ztypes_openbsd_arm.go b/unix/ztypes_openbsd_arm.go
index f190651..2c46750 100644
--- a/unix/ztypes_openbsd_arm.go
+++ b/unix/ztypes_openbsd_arm.go
@@ -98,10 +98,10 @@
F_namemax uint32
F_owner uint32
F_ctime uint64
- F_fstypename [16]int8
- F_mntonname [90]int8
- F_mntfromname [90]int8
- F_mntfromspec [90]int8
+ F_fstypename [16]byte
+ F_mntonname [90]byte
+ F_mntfromname [90]byte
+ F_mntfromspec [90]byte
_ [2]byte
Mount_info [160]byte
}
diff --git a/unix/ztypes_openbsd_arm64.go b/unix/ztypes_openbsd_arm64.go
index 84747c5..ddee045 100644
--- a/unix/ztypes_openbsd_arm64.go
+++ b/unix/ztypes_openbsd_arm64.go
@@ -94,10 +94,10 @@
F_namemax uint32
F_owner uint32
F_ctime uint64
- F_fstypename [16]int8
- F_mntonname [90]int8
- F_mntfromname [90]int8
- F_mntfromspec [90]int8
+ F_fstypename [16]byte
+ F_mntonname [90]byte
+ F_mntfromname [90]byte
+ F_mntfromspec [90]byte
_ [2]byte
Mount_info [160]byte
}
diff --git a/unix/ztypes_openbsd_mips64.go b/unix/ztypes_openbsd_mips64.go
index ac5c8b6..eb13d4e 100644
--- a/unix/ztypes_openbsd_mips64.go
+++ b/unix/ztypes_openbsd_mips64.go
@@ -94,10 +94,10 @@
F_namemax uint32
F_owner uint32
F_ctime uint64
- F_fstypename [16]int8
- F_mntonname [90]int8
- F_mntfromname [90]int8
- F_mntfromspec [90]int8
+ F_fstypename [16]byte
+ F_mntonname [90]byte
+ F_mntfromname [90]byte
+ F_mntfromspec [90]byte
_ [2]byte
Mount_info [160]byte
}

To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sys
Gerrit-Branch: master
Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
Gerrit-Change-Number: 407195
Gerrit-PatchSet: 1
Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
Gerrit-MessageType: newchange

Kirill Kolyshkin (Gerrit)

unread,
May 18, 2022, 11:50:56 PM5/18/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

View Change

1 comment:

To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sys
Gerrit-Branch: master
Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
Gerrit-Change-Number: 407195
Gerrit-PatchSet: 1
Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
Gerrit-Comment-Date: Thu, 19 May 2022 03:50:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Tobias Klauser (Gerrit)

unread,
May 19, 2022, 10:46:24 AM5/19/22
to Kirill Kolyshkin, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com

Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Kirill Kolyshkin.

Patch set 1:Code-Review +2

View Change

    To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sys
    Gerrit-Branch: master
    Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
    Gerrit-Change-Number: 407195
    Gerrit-PatchSet: 1
    Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Kirill Kolyshkin <koly...@gmail.com>
    Gerrit-Comment-Date: Thu, 19 May 2022 14:46:19 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ian Lance Taylor (Gerrit)

    unread,
    May 19, 2022, 6:35:39 PM5/19/22
    to Kirill Kolyshkin, goph...@pubsubhelper.golang.org, Tobias Klauser, Ian Lance Taylor, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Kirill Kolyshkin.

    Patch set 1:Run-TryBot +1Auto-Submit +1Code-Review +2

    View Change

    1 comment:

    To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sys
    Gerrit-Branch: master
    Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
    Gerrit-Change-Number: 407195
    Gerrit-PatchSet: 1
    Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Kirill Kolyshkin <koly...@gmail.com>
    Gerrit-Comment-Date: Thu, 19 May 2022 22:35:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    谢致邦 (Gerrit)

    unread,
    May 20, 2022, 6:25:07 AM5/20/22
    to Kirill Kolyshkin, goph...@pubsubhelper.golang.org, Gopher Robot, Tobias Klauser, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Kirill Kolyshkin.

    Patch set 1:Code-Review +1

    View Change

      To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sys
      Gerrit-Branch: master
      Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
      Gerrit-Change-Number: 407195
      Gerrit-PatchSet: 1
      Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
      Gerrit-Reviewer: 谢致邦 <xiezh...@gmail.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Kirill Kolyshkin <koly...@gmail.com>
      Gerrit-Comment-Date: Fri, 20 May 2022 10:25:00 +0000

      Michael Knyszek (Gerrit)

      unread,
      May 20, 2022, 11:13:02 AM5/20/22
      to Kirill Kolyshkin, goph...@pubsubhelper.golang.org, 谢致邦, Gopher Robot, Tobias Klauser, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

      Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Kirill Kolyshkin.

      Patch set 1:Code-Review +1

      View Change

        To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: sys
        Gerrit-Branch: master
        Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
        Gerrit-Change-Number: 407195
        Gerrit-PatchSet: 1
        Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
        Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
        Gerrit-Reviewer: 谢致邦 <xiezh...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Kirill Kolyshkin <koly...@gmail.com>
        Gerrit-Comment-Date: Fri, 20 May 2022 15:12:58 +0000

        Gopher Robot (Gerrit)

        unread,
        May 20, 2022, 11:13:05 AM5/20/22
        to Kirill Kolyshkin, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, 谢致邦, Tobias Klauser, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Gopher Robot submitted this change.

        View Change


        Approvals: Ian Lance Taylor: Looks good to me, approved; Run TryBots; Automatically submit change Gopher Robot: TryBots succeeded 谢致邦: Looks good to me, but someone else must approve Tobias Klauser: Looks good to me, approved Michael Knyszek: Looks good to me, but someone else must approve
        unix: update openbsd Statfs_t fields

        This changes some fields of openbsd Statfs_t from arrays of int8
        to arrays of byte. This makes the types of those fields correspond to
        the types used on most other BSD systems (Darwin, FreeBSD, NetBSD),
        and simplifies the conversion to Go string.

        Similar changes: CL 359674, CL 259903, CL 74331.

        Note that while this patches mkpost.go, the end result is obtained by
        manual editing of ztypes_openbsd_*.go files. The reasons for this are:

        1. automatic regeneration (tried on openbsd 6.9 / amd64) brings in way
        too many changes (5 files changed, 193 insertions, 45 deletions).

        2. I could not figure out how to run openbsd on non-amd64.

        Nevertheless, this change is sufficient, meaning if someone will
        actually end up regenerating these (see e.g. CL 347649) after this
        commit is merged, the fields will still be kept as arrays of byte.

        Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
        Reviewed-on: https://go-review.googlesource.com/c/sys/+/407195
        Run-TryBot: Ian Lance Taylor <ia...@google.com>
        TryBot-Result: Gopher Robot <go...@golang.org>
        Auto-Submit: Ian Lance Taylor <ia...@google.com>
        Reviewed-by: 谢致邦 <xiezh...@gmail.com>
        Reviewed-by: Michael Knyszek <mkny...@google.com>
        Reviewed-by: Ian Lance Taylor <ia...@google.com>
        Reviewed-by: Tobias Klauser <tobias....@gmail.com>

        ---
        M unix/mkpost.go
        M unix/ztypes_openbsd_386.go
        M unix/ztypes_openbsd_amd64.go
        M unix/ztypes_openbsd_arm.go
        M unix/ztypes_openbsd_arm64.go
        M unix/ztypes_openbsd_mips64.go
        6 files changed, 58 insertions(+), 22 deletions(-)

        To view, visit change 407195. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: sys
        Gerrit-Branch: master
        Gerrit-Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
        Gerrit-Change-Number: 407195
        Gerrit-PatchSet: 2
        Gerrit-Owner: Kirill Kolyshkin <koly...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
        Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
        Gerrit-Reviewer: 谢致邦 <xiezh...@gmail.com>
        Gerrit-MessageType: merged
        Reply all
        Reply to author
        Forward
        0 new messages