use vendoring, build for netbsd/openbsd

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
2015-11-09 07:23:54 +00:00
parent 8c916a8c22
commit 30aa7a9acc
86 changed files with 20358 additions and 5 deletions

23
vendor/github.com/vtolstov/go-ioctl/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,23 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test

21
vendor/github.com/vtolstov/go-ioctl/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Vasiliy Tolstov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4
vendor/github.com/vtolstov/go-ioctl/README.md generated vendored Normal file
View File

@@ -0,0 +1,4 @@
go-ioctl
========
Documentation [![GoDoc](https://godoc.org/github.com/vtolstov/go-ioctl?status.svg)](http://godoc.org/github.com/vtolstov/go-ioctl)

70
vendor/github.com/vtolstov/go-ioctl/ioctl.go generated vendored Normal file
View File

@@ -0,0 +1,70 @@
package ioctl
import "syscall"
// Generic ioctl constants
const (
IOC_NONE = 0x0
IOC_WRITE = 0x1
IOC_READ = 0x2
IOC_NRBITS = 8
IOC_TYPEBITS = 8
IOC_SIZEBITS = 14
IOC_DIRBITS = 2
IOC_NRSHIFT = 0
IOC_TYPESHIFT = IOC_NRSHIFT + IOC_NRBITS
IOC_SIZESHIFT = IOC_TYPESHIFT + IOC_TYPEBITS
IOC_DIRSHIFT = IOC_SIZESHIFT + IOC_SIZEBITS
IOC_NRMASK = ((1 << IOC_NRBITS) - 1)
IOC_TYPEMASK = ((1 << IOC_TYPEBITS) - 1)
IOC_SIZEMASK = ((1 << IOC_SIZEBITS) - 1)
IOC_DIRMASK = ((1 << IOC_DIRBITS) - 1)
)
// Some useful additional ioctl constanst
const (
IOC_IN = IOC_WRITE << IOC_DIRSHIFT
IOC_OUT = IOC_READ << IOC_DIRSHIFT
IOC_INOUT = (IOC_WRITE | IOC_READ) << IOC_DIRSHIFT
IOCSIZE_MASK = IOC_SIZEMASK << IOC_SIZESHIFT
IOCSIZE_SHIFT = IOC_SIZESHIFT
)
// IOC generate IOC
func IOC(dir, t, nr, size uintptr) uintptr {
return (dir << IOC_DIRSHIFT) | (t << IOC_TYPESHIFT) |
(nr << IOC_NRSHIFT) | (size << IOC_SIZESHIFT)
}
// IOR generate IOR
func IOR(t, nr, size uintptr) uintptr {
return IOC(IOC_READ, t, nr, size)
}
// IOW generate IOW
func IOW(t, nr, size uintptr) uintptr {
return IOC(IOC_WRITE, t, nr, size)
}
// IOWR generate IOWR
func IOWR(t, nr, size uintptr) uintptr {
return IOC(IOC_READ|IOC_WRITE, t, nr, size)
}
// IO generate IO
func IO(t, nr uintptr) uintptr {
return IOC(IOC_NONE, t, nr, 0)
}
// IOCTL send ioctl
func IOCTL(fd, name, data uintptr) error {
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, name, data)
if err != 0 {
return syscall.Errno(err)
}
return nil
}

3
vendor/github.com/vtolstov/go-ioctl/ioctl_freebsd.go generated vendored Normal file
View File

@@ -0,0 +1,3 @@
// +build freebsd
package ioctl

33
vendor/github.com/vtolstov/go-ioctl/ioctl_linux.go generated vendored Normal file
View File

@@ -0,0 +1,33 @@
// +build linux
package ioctl
import "unsafe"
// BlkPart send blkpart ioctl to fd
func BlkRRPart(fd uintptr) error {
return IOCTL(fd, IO(0x12, 95), uintptr(0))
}
// BlkPg send blkpg ioctl to fd
func BlkPg(fd, data uintptr) error {
return IOCTL(fd, IO(0x12, 105), data)
return nil
}
type FsTrimRange struct {
Start uint64
Length uint64
MinLength uint64
}
// Fitrim send fitrim ioctl to fd
func Fitrim(fd, data uintptr) error {
r := FsTrimRange{}
return IOCTL(fd, IOWR('X', 121, uintptr(unsafe.Pointer(&r))), data)
}
// Firfreeze send firfreeze ioctl to fd
func Firfreeze(fd, data uintptr) error {
return IOCTL(fd, IOWR('X', 119, uintptr(0)), data)
}