loop

package
v0.0.0-...-48ebc5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2015 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoopSetFd       = C.LOOP_SET_FD
	LoopCtlGetFree  = C.LOOP_CTL_GET_FREE
	LoopGetStatus64 = C.LOOP_GET_STATUS64
	LoopSetStatus64 = C.LOOP_SET_STATUS64
	LoopClrFd       = C.LOOP_CLR_FD
	LoopSetCapacity = C.LOOP_SET_CAPACITY
)

IOCTL consts.

View Source
const (
	LoFlagsAutoClear = C.LO_FLAGS_AUTOCLEAR
	LoFlagsReadOnly  = C.LO_FLAGS_READ_ONLY
	LoFlagsPartScan  = C.LO_FLAGS_PARTSCAN
	LoKeySize        = C.LO_KEY_SIZE
	LoNameSize       = C.LO_NAME_SIZE
)

LOOP consts.

Variables

View Source
var (
	// ErrAttachLoopbackDevice failed to attach the loopback device
	ErrAttachLoopbackDevice = errors.New("loopback mounting failed")
)

Functions

func AttachLoopDevice

func AttachLoopDevice(filename string) (loop *os.File, err error)

AttachLoopDevice attaches the given sparse file to the next available loopback device. It returns an opened *os.File. The loopback file is set to autoclear after the returned file handle is closed.

Example

```

fh, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, 0600)

if err != nil {
  return err
}
if err := fh.Truncate(size); err != nil {
  return err
}
if err := fh.Close(); err != nil {
  return err
}

lHandle, err := loop.AttachLoopDevice(filename)

if err != nil {
  return err
}

[...]

```

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL