1
# This file is part of Checkbox.
3
# Copyright 2012 Canonical Ltd.
5
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
7
# Checkbox is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License version 3,
9
# as published by the Free Software Foundation.
12
# Checkbox is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
21
checkbox.heuristics.dev
22
=======================
26
Documentation: http://udisks.freedesktop.org/docs/latest/
27
Source code: http://cgit.freedesktop.org/systemd/systemd/ (src/udev)
28
Bug tracker: http://bugs.freedesktop.org/ (using systemd product)
32
def is_virtual_device(device_file):
34
Given a device name like /dev/ramX, /dev/sdX or /dev/loopX determine if
35
this is a virtual device. Virtual devices are typically uninteresting to
36
users. The only exception may be nonempty loopback device.
38
Possible prior art: gnome-disks, palimpset (precursor, suffering from this
39
flaw and showing all the /dev/ram devices by default)
41
for part in device_file.split("/"):
42
if part.startswith("ram") or part.startswith("loop"):