3 # Display a list of known disks and partitions
5 require './format-lib.pl';
6 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
7 &help_search_link("format", "man"));
10 print "<table border width=100%>\n";
11 print "<tr $tb> <td><b>$text{'index_disk'}</b></td> ",
12 "<td><b>$text{'index_parts'}</b></td> </tr>\n";
13 @dlist = &list_disks();
14 $mountcan = &foreign_available("mount");
15 for($i=0; $i<@dlist; $i++) {
17 next if (!&can_edit_disk($dl->{'device'}));
18 print "<tr $cb> <td valign=top><table>\n";
19 print "<tr> <td><b>$text{'index_location'}</b></td> ";
20 print "<td>$dl->{'desc'}</td> </tr>\n";
21 print "<tr> <td><b>$text{'index_cyl'}</b></td>\n";
22 print "<td>$dl->{'cyl'}</td> </tr>\n";
23 print "<tr> <td><b>$text{'index_model'}</b></td> ";
24 print "<td>",$dl->{'type'} ? $dl->{'type'} : $text{'index_unknown'},
26 print "</table></td> <td valign=top>\n";
27 if (!$dl->{'device'}) {
28 # Drive type unknown..
29 print "<b>$text{'index_unknown2'}</b>\n";
31 elsif (@parts = &list_partitions($dl->{'device'})) {
32 # Known and formatted..
33 print "<table width=100%>\n";
34 print "<tr> <td><b>$text{'index_no'}</b></td> ",
35 "<td><b>$text{'index_type'}</b></td> ",
36 "<td><b>$text{'index_extent'}</b></td> ",
37 "<td><b>$text{'index_start'}</b></td> ",
38 "<td><b>$text{'index_end'}</b></td> ",
39 "<td><b>$text{'index_use'}</b></td> ",
40 "<td><b>$text{'index_free'}</b></td> </tr>\n";
41 for($j=0; $j<@parts; $j++) {
44 if ($access{'view'}) {
48 print "<a href=\"edit_part.cgi?$i+$j\">$j</a>";
50 print "</td> <td>$p->{'tag'}</td> <td>\n";
51 if ($p->{'end'} != 0) {
53 "<img src=images/gap.gif height=10 width=%d>",
54 $extwidth*$p->{'start'}/$dl->{'cyl'};
56 "<img src=images/use.gif height=10 width=%d>",
57 $extwidth*($p->{'end'}-$p->{'start'})/
60 "<img src=images/gap.gif height=10 width=%d>",
61 $extwidth*($dl->{'cyl'}-$p->{'end'})/
63 print "</td> <td>$p->{'start'}</td> ",
64 "<td>$p->{'end'}</td> <td>\n";
65 @stat = &device_status($p->{'device'});
66 if ($stat[1] =~ /^meta/) {
70 print "<tt>$stat[0]</tt>\n";
72 elsif ($stat[0] && $stat[3] == -1) {
73 print "<tt><a href=/mount/edit_mount.cgi?index=$stat[4]&temp=1&return=/$module_name/>$stat[0]</a></tt>\n";
76 print "<tt><a href=/mount/edit_mount.cgi?index=$stat[3]&return=/$module_name/>$stat[0]</a></tt>\n";
79 if ($stat[0] ne 'swap' &&
80 (@space = &disk_space($p->{'device'})) &&
83 100 * $space[1] / $space[0];
85 print "</td> </tr>\n";
87 else { print "<td colspan=5></td>\n"; }
92 # Disk is not formatted..
93 print "<b>$text{'index_format'}</b>\n";
95 print "</td> </tr>\n";
97 print "</table><p>\n";
99 &ui_print_footer("/", $text{'index'});