File: ioctl_linux.go

package info (click to toggle)
golang-github-vtolstov-go-ioctl 0.0~git20151206.6be9cce-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80 kB
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 796 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// +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)
}

// Fifreeze send fifreeze ioctl to fd
func Fifreeze(fd, data uintptr) error {
	return IOCTL(fd, IOWR('X', 119, uintptr(0)), data)
}

// Fithaw send fithaw ioctl to fd
func Fithaw(fd, data uintptr) error {
	return IOCTL(fd, IOWR('X', 120, uintptr(0)), data)
}