(** A type representing a block device. *) type t = { number : int; } val sys_mount_point : string (** Where the sysfs file system is mounted, i.e. /sys *) (** {2 Block.t constructors and accessors } *) val of_node : string -> t (** Construct a device from the path to the device node *) val of_path : string -> t (** Construct a device for the device holding a path *) val of_devno : int -> t (** Construct a device from a device number *) val of_sysname : string -> t (** Construct a device from a device name in /sys/block *) val of_syspath : string -> t (** Constuct a device from a path in /sys *) val to_devno : t -> int (** Return the device number *) val major : t -> int (** Return a device's major number. *) val minor : t -> int (** Return a device's minor number. *) val of_major_minor : int -> int -> t (** Construct a device from its major and minor numbers *) val path : t -> string (* deprecated, use node *) val node : t -> string (** Return the path of a device node. Preferred form is the /dev followed by the device's sysname. *) val sysname : t -> string (** Return the device name in /sys *) val compare : t -> t -> int (** Compare two block devices *) val eq : t -> t -> bool val split_part : string -> string * int (** Split "hda3" into ("hda", 3) *) val partition_number : t -> int (** Given "hda3" return 3 *) val sysdir : t -> string (** Given a device node such as (of_path "/dev/hda3"), return /sys/block/hda/hda3 *) val disk_of_part : t -> t (** Return the disk holding a partition. @raise Not_found if device is not a partition. *) (** {2 Root device functions} *) val root_part : unit -> t (** Return the partition that holds "/". Note that this will change in a chroot. *) val is_root_part : t -> bool (** True if the partition is the root *) (** {2 Retrieve device lists} *) val get_all : unit -> t list val get_all_disks : unit -> t list val get_all_partitions : unit -> t list val get_all_cdroms : unit -> t list val get_all_removable : unit -> t list (** {2 /proc/devices info} *) val to_devname : t -> string option (** Return the device's name in /proc/devices. If this returns None we probably need to call update. *) (** {2 Blkid info} *) val get_blkid_alist : t -> (string * string) list (** [get_blkid_alist device] return an association list containing all the blkid info for a device. *) val get_blkid_info : t -> string -> string (** [get_blkid_info device tag] returns the value of TAG in the device's blkid info *) val device_of_uuid : string -> t (** Return the device that has the given UUID. *) val devices_of_label : string -> t list (** Return the devices that have the given LABEL. *) val update_blkid_fns : unit -> unit (** Re-read the blkid information so the functions above return updated results. This is called by update below. *) (** {2 Flush device info cache} *) val update : unit -> unit (** Re-read /sys and /dev and /proc/devices to get the current mappings of device numbers to device names and sys names. *)