safe ways to manipulate file size in Perl-based applications

Chapman Flack <[email protected]>
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
Hi -hackers,

A couple of questions about manipulating file sizes and offsets
in an application using the Perl interface....

The wiki document
https://wiki.zmanda.com/index.php/Perl_Interface
talks about Perl's way of silently switching to doubles
if a value is too big for an int, and then probably losing
precision if the value is wider than 54 bits, and Amanda's
convention of using Math::BigInt at the interface to avoid
that.

So what I'm wondering is, does the Amanda perl interface make
some perl functions available that accept and return file
sizes/offsets in that form? For example, an Amanda version of
tell() that returns a Math::BigInt, or an Amanda seek() that
takes one?

I glanced through Amanda::Util but I didn't find them there.

Other question: looking at amraw as an example, I see that
estimate and backup both output the size by first doing a
flooring division by 1024, then applying a 32k minimum ...
in other words, any size up to 32k plus 1023 will show
as 32k, anything up to 33k plus 1023 will show as 33k, etc.

I see that I've written my own code out of habit to do
ceiling division, so anything 1 byte more than 32k will
show as 33k, 1 byte more than 33k shows as 34k, etc.
Is that ok, or will it break something ... is there something
in the Amanda machinery that launches my application that
really does depend on the sizes being floored?

Thanks,
-Chap
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.