Exemple #1
0
func afs_syscall(call uintptr, param1 uintptr, param2 uintptr, param3 uintptr, param4 uintptr) error {
	fd, err := syscall.Open("/proc/fs/openafs/afs_ioctl", syscall.O_RDWR, 0)

	if err != nil {
		fd, err = syscall.Open("/proc/fs/nnpfs/afs_ioctl", syscall.O_RDWR, 0)
	}

	if err != nil {
		return err
	}

	data := afsprocdata{
		param4,
		param3,
		param2,
		param1,
		call,
	}

	err = gioctl.Ioctl(uintptr(fd), gioctl.IoW(67, 1, unsafe.Sizeof(uintptr(0))), uintptr(unsafe.Pointer(&data)))

	syscall.Close(fd)

	return err
}
Exemple #2
0
func afs_syscall(call uintptr, param1 uintptr, param2 uintptr, param3 uintptr, param4 uintptr) error {
	fd, err := syscall.Open("/dev/openafs_ioctl", syscall.O_RDWR, 0)

	if err != nil {
		return err
	}

	if intSize == 32 {
		data := afsprocdata32{
			call,
			param1,
			param2,
			param3,
			param4,
			0,
			0,
			0,
		}

		err = gioctl.Ioctl(uintptr(fd), gioctl.IoW(67, 1, unsafe.Sizeof(uintptr(0))), uintptr(unsafe.Pointer(&data)))
	} else {
		data := afsprocdata64{
			param1,
			param2,
			param3,
			param4,
			0,
			0,
			int32(call),
			0,
		}

		err = gioctl.Ioctl(uintptr(fd), gioctl.IoW(67, 2, unsafe.Sizeof(uintptr(0))), uintptr(unsafe.Pointer(&data)))
	}

	syscall.Close(fd)

	return err
}
Exemple #3
0
package linux

import "github.com/paypal/gatt/linux/gioctl"

const (
	ioctlSize     = uintptr(4)
	hciMaxDevices = 16
	typHCI        = 72 // 'H'
)

var (
	hciUpDevice      = gioctl.IoW(typHCI, 201, ioctlSize) // HCIDEVUP
	hciDownDevice    = gioctl.IoW(typHCI, 202, ioctlSize) // HCIDEVDOWN
	hciResetDevice   = gioctl.IoW(typHCI, 203, ioctlSize) // HCIDEVRESET
	hciGetDeviceList = gioctl.IoR(typHCI, 210, ioctlSize) // HCIGETDEVLIST
	hciGetDeviceInfo = gioctl.IoR(typHCI, 211, ioctlSize) // HCIGETDEVINFO
)

type devRequest struct {
	id  uint16
	opt uint32
}

type devListRequest struct {
	devNum     uint16
	devRequest [hciMaxDevices]devRequest
}

type hciDevInfo struct {
	id         uint16
	name       [8]byte
Exemple #4
0
// Destroy all AFS tokens
func Unlog() error {
	iob := ViceIoctl{0, 0, 0, 0}

	return afs_pioctl(nil, gioctl.IoW(86, 9, unsafe.Sizeof(ViceIoctl{})), &iob, false)
}