X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=misc%2Ftest_vm%2Fscripts%2Fnumsecs;fp=misc%2Ftest_vm%2Fscripts%2Fnumsecs;h=708a8939ec2482e5017de8eb626d8f08d496f9a2;hp=0000000000000000000000000000000000000000;hb=ddc16b0737cf58f7aa90a69c6652cdf4090aec51;hpb=626595465a2c6987606a6bc697df65130ad8c2d3 diff --git a/misc/test_vm/scripts/numsecs b/misc/test_vm/scripts/numsecs new file mode 100755 index 0000000..708a893 --- /dev/null +++ b/misc/test_vm/scripts/numsecs @@ -0,0 +1,23 @@ +#! /usr/bin/perl + +# Find the number of 512-byte sectors needed to store +# given file. + +# $Revision: 1.1 $ + +use strict qw(refs vars); + +if ( scalar(@ARGV) != 1 ) { + print STDERR "Usage: numsecs \n"; + exit 1; +} + +my $filename = shift @ARGV; +my $size = (-s $filename ); +die "Couldn't get size of $filename: $!" if ( !defined $size ); + +my $result = int($size / 512); +my $remainder = $size % 512; +$result++ if ( $remainder > 0 ); + +print "$result\n";