diff --git a/gpioioctl/basic_test.go b/gpioioctl/basic_test.go index afd6704..9e6bf2e 100644 --- a/gpioioctl/basic_test.go +++ b/gpioioctl/basic_test.go @@ -7,7 +7,6 @@ // folder. //go:build linux -// +build linux package gpioioctl diff --git a/gpioioctl/example_test.go b/gpioioctl/example_test.go index 1406922..a5af380 100644 --- a/gpioioctl/example_test.go +++ b/gpioioctl/example_test.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package gpioioctl_test diff --git a/gpioioctl/gpio.go b/gpioioctl/gpio.go index f72c82e..2005c3a 100644 --- a/gpioioctl/gpio.go +++ b/gpioioctl/gpio.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package gpioioctl diff --git a/gpioioctl/ioctl.go b/gpioioctl/ioctl.go index 7621a12..c45cdbb 100644 --- a/gpioioctl/ioctl.go +++ b/gpioioctl/ioctl.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package gpioioctl diff --git a/gpioioctl/lineset.go b/gpioioctl/lineset.go index f257f74..8eeb361 100644 --- a/gpioioctl/lineset.go +++ b/gpioioctl/lineset.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package gpioioctl diff --git a/netlink/netlink_linux.go b/netlink/netlink_linux.go index 76774c7..40fee69 100644 --- a/netlink/netlink_linux.go +++ b/netlink/netlink_linux.go @@ -11,11 +11,6 @@ import ( const isLinux = true -// connSocket is a simple wrapper around a Linux netlink connector socket. -type connSocket struct { - fd int -} - // newConnSocket returns a socket instance. func newConnSocket() (*connSocket, error) { // Open netlink socket. diff --git a/netlink/netlink_other.go b/netlink/netlink_other.go index 66a4812..ed37043 100644 --- a/netlink/netlink_other.go +++ b/netlink/netlink_other.go @@ -11,10 +11,6 @@ import "errors" const isLinux = false -type connSocket struct { - fd int -} - func newConnSocket() (*connSocket, error) { return nil, errors.New("netlink sockets are not supported") } diff --git a/netlink/onewire.go b/netlink/onewire.go index 30cb6b0..9381a76 100644 --- a/netlink/onewire.go +++ b/netlink/onewire.go @@ -263,13 +263,6 @@ type socket interface { close() error } -// w1Socket is a netlink connector socket for communicating with the w1 Linux -// kernel module. -type w1Socket struct { - s socket - fd int -} - // newW1Socket returns a socket instance. func newW1Socket() (*w1Socket, error) { // Open netlink socket. diff --git a/netlink/socket.go b/netlink/socket.go new file mode 100644 index 0000000..fbd5e6f --- /dev/null +++ b/netlink/socket.go @@ -0,0 +1,15 @@ +//go:build !windows + +package netlink + +// connSocket is a simple wrapper around a Linux netlink connector socket. +type connSocket struct { + fd int +} + +// w1Socket is a netlink connector socket for communicating with the w1 Linux +// kernel module. +type w1Socket struct { + s socket + fd int +} diff --git a/netlink/socket_windows.go b/netlink/socket_windows.go new file mode 100644 index 0000000..38c1832 --- /dev/null +++ b/netlink/socket_windows.go @@ -0,0 +1,21 @@ +package netlink + +// Copyright 2024 The Periph Authors. All rights reserved. +// Use of this source code is governed under the Apache License, Version 2.0 +// that can be found in the LICENSE file. + +import ( + "syscall" +) + +// connSocket is a simple wrapper around a Linux netlink connector socket. +type connSocket struct { + fd syscall.Handle +} + +// w1Socket is a netlink connector socket for communicating with the w1 Linux +// kernel module. +type w1Socket struct { + s socket + fd syscall.Handle +}