1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# Many thanks to Alexander Leidinger <netchild@FreeBSD.org> and
# Franz Klammer <klammer@webonaut.com> for help and create
# those patches.
#
# Note that, this is for now. One of us still need to fix the
# libgtop to correct read the partition so this patch can be
# remove.
--- libdesklets/Disk.py.orig Mon Nov 17 13:59:20 2003
+++ libdesklets/Disk.py Mon Nov 17 14:05:34 2003
@@ -1,6 +1,6 @@
import glibtop
import polling
-
+import os
class Disk:
@@ -13,18 +13,22 @@
def __poll_partitions(self):
- data = glibtop.get_mountlist(0)
- partitions = []
- for size, device, mpoint, fstype in data:
- if (fstype in ("ext2", "ext3", "msdos", "vfat", "ntfs", "hpfs"
- "jfs", "reiserfs", "xfs", "qnx4", "adfs", "ffs",
- "hfs", "befs", "bfs", "efs", "iso9660", "minix",
- "sysv", "coda", "nfs", "udf", "ufs", "xiafs")):
- partitions.append((device, mpoint))
+ fd = os.popen("mount -p")
+ data = fd.readlines()
+ fd.close()
+
+ partitions = []
+ for lines in data:
+ fields = lines.strip().replace("\t", " ").split()
+ if (fields[2] in ("ext2", "ext3", "msdos", "vfat", "ntfs", "hpfs"
+ "jfs", "reiserfs", "xfs", "qnx4", "adfs", "ffs",
+ "hfs", "befs", "bfs", "efs", "iso9660", "minix",
+ "sysv", "coda", "nfs", "udf", "ufs", "xiafs")):
+ partitions.append((fields[0], fields[1]))
#end for
return partitions
-
+
def __poll_size(self, partition):
|