3 require "./fdisk-lib.pl";
5 &can_edit_disk($in{'drive'}) || &error($text{'edit_ecannot'});
7 if( $in{ 'action' } eq $text{ 'hdparm_apply' } )
9 &ui_print_header(undef, $text{ 'hdparm_apply' }, "");
11 local $command = "hdparm ";
13 foreach $key ( 'a', 'd', 'r', 'k', 'u', 'm', 'c', 'A', 'K', 'P', 'X', 'W', 'S' )
15 $command .= "-".$key." ".$in{ $key }." " if( $in{ $key } ne "" );
17 $command .= $in{ 'drive' }."\n";
19 local $out = "<p>". $text{ 'hdparm_performing' }. " : <b>". $command. "</b><i>". &backquote_logged($command). "</i><p>";
21 &webmin_log("hdparm", undef, $in{'drive'}, \%in);
25 &ui_print_header(undef, $text{'hdparm_speed'}, "");
27 local ( $_, $_, $buffered, $buffer_cache ) = split( /\n/, `hdparm -t -T $in{ 'drive' }` );
28 ( $_, $buffered ) = split( /=/, $buffered );
29 ( $_, $buffer_cache ) = split( /=/, $buffer_cache );
31 print &ui_table_start($text{'hdparm_speedres'}, undef, 2,[ "width=30%" ]);
32 print &ui_table_row($text{'hdparm_buf1'}, $buffered);
33 print &ui_table_row($text{'hdparm_buf2'}, $buffer_cache);
34 print &ui_table_end();
37 &ui_print_footer( "", $text{ 'index_return' } );