Re: offset zero stored in catalog
Denis Corbin <[email protected]> Sat, 05 Mar 2005 00:08:25 +0100
| Newsgroups | gmane.comp.sysutils.backup.dar.general |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Wesley Leggette wrote: | For the offsets stored in the catalog, where is the zero point? | | +---------+---------+--------------------------------+---------+------+ | | slice | archive | data | catalog | term | | | header | header | | | | | +---------+---------+--------------------------------+---------+------+ | ^ ^ | A B | | Is it at point A or B? point A, but that's not exactly this way it works... ~ +----+--+----+-...........+---------+ archive |file|EA|file| |catalogue| layout |data| |data| | | ~ +----+--+----+-...........+---------+ ~ | | | ~ | | | ~ V V V ~ +-----------------------------------+ compression | (compressed) data | ~ +-----------------------------------+ ~ | | ~ | | / Terminateur ~ | | | ~ | | V elastic +---+ | | +----+---+ buffers |EEE| | | |TTTT|EEE| ~ +---+ | | +----+---+ ~ | | | | ~ V V V V ~ +--------------------------------------------------+ cipher | (encrypted) data | ~ +--------------------------------------------------+ header\ | | version| | | ~ | | | ~ | | | ~ V V V ~ +------------------------------------------------------+ sar |VVV| data | ~ +------------------------------------------------------+ ~ | | | | | | | | | slice | | | | | | | | | headers | | | | | | | | | ~ | | | | | | | | | | | ~ | +---|------\ | | | | | | | | ~ V V V V V V V V V V V +---------+ +---------+ +---------+ +---------+ +-------+ |HH| data | |HH| data | |HH| data | |HH| data | |HH|data| +---------+ +---------+ +---------+ +---------+ +-------+ ~ slice 1 slice 2 slice 3 slice 4 slice 5 is used either "sar" or "tuyau" (for writing/reading from/to pipes) or "fichier" (for single slice archive) or "null_file" (when doing dry-run execution, in that later case there is no compression layer nor there is encryption layer even if specified on command-line). The offset in catalogue defines the position of the first bytes of a file's data as given by the underlying layer (the compression object, if present, for example). Compression offset returns the position of the underlying layer in any case (if you write 10 bytes than get compressed to 5 bytes, the new offset reported by compressor will be 5 bytes further, while you have wrote 10 to it!), so position zero is position zero of the underlying layer (which is cypher, if present). The cypher layer alters the offset when the encrypted data takes more place than the clear data, the offset that reported by the cypher object is always the number of clear bytes written to it, even if more are written to the underlying layer due to encryption, but the offset of the first byte written matches the offset of the underlying layer (sar), so the first byte written in a cypher object (scrambler or blowfish for example) is not usually reported at position 0, because the header_version structure has already been written to the underlying layer (sar object), before the cypher object has been attached over it. The sar object reports as offset the number of bytes written (or the number of bytes read). The first byte is at position zero. The sar object emulates a giant file splitting the written data to several 'fichier' objects, or when reading, gather the data from several 'fichier' object. Note that all classes like scrambler, compressor, blowfish, fichier, sar, tuyau, null_file and some other inherit from a same pure virtual class called "generic_file", that provides standard method for reading, writing, skipping, or getting the offset in a "file". This way, if for example encryption is not used, the compression object writes directly to the sar object, which is also a "generic_file" object, same remark if compression is not used, of if archive splitting is not used. In the most simple case (no encryption, so slicing, no compression) the archive layout goes directly to a "fichier" which is in fact a plain file wrapped in a object having the "generic_file" interface. | Thanks. | Cheers, Denis. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFCKOpppC5CI8gYGlIRAoJjAKCYgPwQwrBmX+BRzs92wllsfFHn1gCfXsW2 VlaIhRPsI3HvnDggSoPzc/s= =Og4q -----END PGP SIGNATURE----- ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click