Documentation ¶
Overview ¶
Package crosdisks provides an interface to talk to cros_disks service via D-Bus.
Package crosdisks provides an interface to talk to cros_disks service via D-Bus and utilities.
Index ¶
- Constants
- type CrosDisks
- func (c *CrosDisks) AddDeviceToAllowlist(ctx context.Context, devicePath string) error
- func (c *CrosDisks) Close() error
- func (c *CrosDisks) EnumerateDevices(ctx context.Context) ([]string, error)
- func (c *CrosDisks) Format(ctx context.Context, path, fsType string, options []string) error
- func (c *CrosDisks) FormatAndWaitForCompletion(ctx context.Context, path, fsType string, options []string) (DeviceOperationCompleted, error)
- func (c *CrosDisks) GetDeviceProperties(ctx context.Context, devicePath string) (map[string]dbus.Variant, error)
- func (c *CrosDisks) Mount(ctx context.Context, devicePath, fsType string, options []string) error
- func (c *CrosDisks) MountAndWaitForCompletion(ctx context.Context, devicePath, fsType string, options []string) (MountCompleted, error)
- func (c *CrosDisks) RemoveDeviceFromAllowlist(ctx context.Context, devicePath string) error
- func (c *CrosDisks) Rename(ctx context.Context, path, volumeName string) error
- func (c *CrosDisks) RenameAndWaitForCompletion(ctx context.Context, path, volumeName string) (DeviceOperationCompleted, error)
- func (c *CrosDisks) Unmount(ctx context.Context, devicePath string, options []string) (uint32, error)
- func (c *CrosDisks) WatchMountCompleted(ctx context.Context) (*MountCompletedWatcher, error)
- type DeviceOperationCompleted
- type DeviceOperationCompletionWatcher
- type LoopbackDevice
- type MountCompleted
- type MountCompletedWatcher
Constants ¶
const ( MountErrorNone uint32 = 0 MountErrorPathNotMounted uint32 = 6 MountErrorMountProgramFailed uint32 = 12 MountErrorNeedPassword uint32 = 13 MountErrorInvalidDevicePath uint32 = 100 )
See MountErrorType defined in system_api/dbus/cros-disks/dbus-constants.h
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CrosDisks ¶
type CrosDisks struct {
// contains filtered or unexported fields
}
CrosDisks is used to interact with the CrosDisks process over D-Bus. For detailed spec of each D-Bus method, please find src/platform2/cros-disks/dbus_bindings/org.chromium.CrosDisks.xml.
func (*CrosDisks) AddDeviceToAllowlist ¶
AddDeviceToAllowlist calls CrosDisks.AddDeviceToAllowlist D-Bus method.
func (*CrosDisks) EnumerateDevices ¶
EnumerateDevices calls CrosDisks.EnumerateDevices D-Bus method.
func (*CrosDisks) FormatAndWaitForCompletion ¶
func (c *CrosDisks) FormatAndWaitForCompletion(ctx context.Context, path, fsType string, options []string) (DeviceOperationCompleted, error)
FormatAndWaitForCompletion formats volume and waits for the response signal.
func (*CrosDisks) GetDeviceProperties ¶
func (c *CrosDisks) GetDeviceProperties(ctx context.Context, devicePath string) (map[string]dbus.Variant, error)
GetDeviceProperties calls CrosDisks.GetDeviceProperties D-Bus method.
func (*CrosDisks) MountAndWaitForCompletion ¶
func (c *CrosDisks) MountAndWaitForCompletion(ctx context.Context, devicePath, fsType string, options []string) (MountCompleted, error)
MountAndWaitForCompletion mounts and waits for the response signal. This is a convenience method for the odd CrosDisks' mounting API.
func (*CrosDisks) RemoveDeviceFromAllowlist ¶
RemoveDeviceFromAllowlist calls CrosDisks.RemoveDeviceFromAllowlist D-Bus method.
func (*CrosDisks) RenameAndWaitForCompletion ¶
func (c *CrosDisks) RenameAndWaitForCompletion(ctx context.Context, path, volumeName string) (DeviceOperationCompleted, error)
RenameAndWaitForCompletion renames volume and waits for the response signal.
func (*CrosDisks) Unmount ¶
func (c *CrosDisks) Unmount(ctx context.Context, devicePath string, options []string) (uint32, error)
Unmount calls CrosDisks.Unmount D-Bus method.
func (*CrosDisks) WatchMountCompleted ¶
func (c *CrosDisks) WatchMountCompleted(ctx context.Context) (*MountCompletedWatcher, error)
WatchMountCompleted registers the signal watching and returns its watcher instance.
type DeviceOperationCompleted ¶
DeviceOperationCompleted holds status of the operation done.
type DeviceOperationCompletionWatcher ¶
type DeviceOperationCompletionWatcher struct {
dbusutil.SignalWatcher
}
DeviceOperationCompletionWatcher is a thin wrapper of dbusutil.SignalWatcher to return signal content as DeviceOperationCompleted.
func (*DeviceOperationCompletionWatcher) Wait ¶
func (m *DeviceOperationCompletionWatcher) Wait(ctx context.Context) (DeviceOperationCompleted, error)
Wait waits for the DeviceOperationCompleted signal, and returns the body data of the received signal.
type LoopbackDevice ¶
type LoopbackDevice struct {
// contains filtered or unexported fields
}
LoopbackDevice holds info about a created loopback device.
func CreateLoopbackDevice ¶
func CreateLoopbackDevice(ctx context.Context, sizeBytes int64) (*LoopbackDevice, error)
CreateLoopbackDevice creates a loopback device backed by a file of the specified size.
func (*LoopbackDevice) Close ¶
func (l *LoopbackDevice) Close(ctx context.Context) (err error)
Close detaches the loopback device and removes the file backing it.
func (*LoopbackDevice) DevicePath ¶
func (l *LoopbackDevice) DevicePath() string
DevicePath returns the device path in /dev.
func (*LoopbackDevice) SysDevicePath ¶
func (l *LoopbackDevice) SysDevicePath() string
SysDevicePath returns the device path in /sys.
type MountCompleted ¶
MountCompleted holds the body data of MountCompleted signal.
type MountCompletedWatcher ¶
type MountCompletedWatcher struct {
dbusutil.SignalWatcher
}
MountCompletedWatcher is a thin wrapper of dbusutil.SignalWatcher to return signal content as MountCompleted.
func (*MountCompletedWatcher) Wait ¶
func (m *MountCompletedWatcher) Wait(ctx context.Context) (MountCompleted, error)
Wait waits for the MountCompleted signal, and returns the body data of the received signal.