buse

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 6 Imported by: 1

README

Linux userspace virtual block device in Go

The idea is similar to FUSE but works for block devices. It uses nbd over a unix socket.

Usage scenario

package main

import (
    "github.com/dop251/buse"
    "github.com/dop251/nbd"
)

// Implement your custom driver as nbd.Driver.
var driver nbd.Driver = ....

dev := buse.NewDevice("/dev/nbd0", size, driver)
dev.Run()
// The device will become available as /dev/nbd0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(device string, size int64, driver nbd.Driver) (*Device, error)

func (*Device) Disconnect

func (bd *Device) Disconnect()

Disconnect disconnects the Device and interrupts the Run()

func (*Device) Run

func (bd *Device) Run() error

Run connects a Device to an actual device file and starts handling requests. It does not return until it's done serving requests.

func (*Device) SetBlockSize

func (bd *Device) SetBlockSize(size int)

func (*Device) SetLogger

func (bd *Device) SetLogger(log *logrus.Logger)

func (*Device) SetMaxProc

func (bd *Device) SetMaxProc(p int)

func (*Device) SetPool

func (bd *Device) SetPool(pool nbd.ProcPool)

func (*Device) SetReadOnly added in v1.2.0

func (bd *Device) SetReadOnly(flag bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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