Skip to content

mount: use MNT_* flags from golang.org/x/sys/unix on freebsd#36

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
tklauser:freebsd-x-sys-unix
Sep 23, 2020
Merged

mount: use MNT_* flags from golang.org/x/sys/unix on freebsd#36
cpuguy83 merged 1 commit intomoby:masterfrom
tklauser:freebsd-x-sys-unix

Conversation

@tklauser
Copy link
Copy Markdown
Contributor

Bump golang.org/x/sys/unix to the latest version and use the MNT_*
constants defined there instead of getting them from sys/mount.h using
cgo.

Full diff for the golang.org/x/sys/unix bump: golang/sys@d5e6a3e...aee5d88

Bump golang.org/x/sys/unix to the latest version and use the MNT_*
constants defined there instead of getting them from sys/mount.h using
cgo.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice 👍

@cpuguy83 @kolyshkin PTAL

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpuguy83 cpuguy83 merged commit 4a8c65a into moby:master Sep 23, 2020
@kolyshkin
Copy link
Copy Markdown
Collaborator

Nice, thank you @tklauser!

Not really related, but is there any chance FreeBSD's getmntent(2) would be implemented in x/sys/unix? It is used by mountinfo package, here:

count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT))

@tklauser tklauser deleted the freebsd-x-sys-unix branch September 24, 2020 08:39
@tklauser
Copy link
Copy Markdown
Contributor Author

Not really related, but is there any chance FreeBSD's getmntent(2) would be implemented in x/sys/unix? It is used by mountinfo package, here:

count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT))

@kolyshkin Thanks. I assume you meant getmntinfo(2), not getmntent(2)? Looking at its implementation

https://github.com/freebsd/freebsd/blob/726c74451f3a4fd9f97e0253f5929f3342bfd88d/lib/libc/gen/getmntinfo.c#L44-L70

it seems it is not a syscall by itself but using the getfsstat(2) syscall internally. This one is already wrapped by golang.org/x/sys/unix:

https://github.com/golang/sys/blob/d9f96fdee20d1e5115ee34ba4016eae6cfb66eb9/unix/syscall_freebsd.go#L160

So it should be fairly straight-forward to implement getmntinfo in Go using it.

@thaJeztah
Copy link
Copy Markdown
Member

@kolyshkin ^ were you interested in contributing that change?

@thaJeztah thaJeztah mentioned this pull request Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants