Documentation
¶
Overview ¶
Package udisks lists the system's volumes through UDisks2 over the system D-Bus, mounted or not, and mounts, unlocks and ejects them as the user, as GVfs's udisks2 volume monitor does for GTK's places sidebar. Polkit lets an active local session do all of it.
Index ¶
- Constants
- Variables
- func Message(err error) string
- type Client
- func (c *Client) Eject(ctx context.Context, v Volume) error
- func (c *Client) Mount(ctx context.Context, object dbus.ObjectPath) (string, error)
- func (c *Client) Unlock(ctx context.Context, object dbus.ObjectPath, passphrase []byte) (dbus.ObjectPath, error)
- func (c *Client) Volumes(ctx context.Context) ([]Volume, error)
- func (c *Client) Watch(changed func()) (stop func(), err error)
- type Volume
Constants ¶
const ( BusName = "org.freedesktop.UDisks2" ManagerPath = dbus.ObjectPath("/org/freedesktop/UDisks2") BlockIface = BusName + ".Block" FilesystemIface = BusName + ".Filesystem" EncryptedIface = BusName + ".Encrypted" DriveIface = BusName + ".Drive" // ErrDeviceBusy is UDisks2's error for a filesystem in use. ErrDeviceBusy = BusName + ".Error.DeviceBusy" )
The UDisks2 names a client talks to.
Variables ¶
var ErrBusy = errors.New("udisks: the volume is in use")
ErrBusy is an unmount UDisks2 refused because the filesystem is in use.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a UDisks2 client on a system bus connection the caller owns.
func (*Client) Eject ¶
Eject unmounts the volume everywhere, locks the container it was unlocked from, and powers its drive off or ejects its media. A filesystem in use is ErrBusy and leaves the drive as it is.
func (*Client) Unlock ¶
func (c *Client) Unlock(ctx context.Context, object dbus.ObjectPath, passphrase []byte) (dbus.ObjectPath, error)
Unlock unlocks the encrypted container on object with passphrase and reports its cleartext device. The passphrase goes to the bus straight from the slice, which is zeroed once the call is answered.
type Volume ¶
type Volume struct {
Object dbus.ObjectPath
Label string
Size uint64
Icon string
MountPoints []string
Locked bool
Removable bool
// contains filtered or unexported fields
}
Volume is one volume the user may see: a filesystem, or an encrypted container still locked. Object is the block device to mount, the cleartext device of an unlocked container; MountPoints are where it is mounted now; Icon is the icon UDisks2 hints, "" for none. Removable volumes can be ejected.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package udiskstest is a fake UDisks2 on a private bus: drives and their volumes a test adds and removes, mounted into directories the test owns, so nothing on the host is ever mounted.
|
Package udiskstest is a fake UDisks2 on a private bus: drives and their volumes a test adds and removes, mounted into directories the test owns, so nothing on the host is ever mounted. |