NAME

Sys::Export::Extent - Represents a range of bytes and data that needs written there

DESCRIPTION

This object is used as a base class for various types of data structure that are based around writing data to a range of bytes within a device image.

Semantics:

device_offset >= 0, size > 0, defined data

The data needs written to the range of bytes described. It will be padded with NUL bytes if it is shorter than the range, and truncated if it is longer than the range.

device_offset >= 0, size > 0, no data

The extent is a known range of the device image, and the data is either already there, or will be written by the user at a later time.

undefined device_offset

We don't know where the extent will be yet, and the export modules should decide where to put it automatically.

device_offset < 0

We don't know where the extent will be yet, and export modules should ignore it for now. The user will update device_offset later.

Device offsets are restricted to 'block_size' (512 by default).

Modifying size to a different multiple of 'block_size' after device_offset is set is an error. Be sure to set size before device_offset.

CONSTRUCTORS

new

$file= Sys::Export::Extent->new(%attributes);

Represents file (or directory) data to be encoded into the ISO image.

coerce

$partition= Sys::Export::GPT::Partition->new($x);

If $x is a hashref, construct a new Extent object. If $x is already an Extent object, return it.

ATTRIBUTES

name

Informative name of extent, for debugging. Default name is 'extent'.

block_size

Power-of-2 restriction on device_offset, 512 by default.

size

Size, in bytes. If nonzero, cannot be changed to a different multiple of block_size after device_offset has been set to a non-negative value.

(this is useful to catch bugs related to resizing things after they'be been allocated to a location in the image)

device_offset

Byte offset of this extent within the device image. When written to a non-negative value, the value must be a multiple of block_size. undef may be used to request an Export module to choose a location for this extent, and -1 may be used to prevent the Export module from doing that yet.

start_lba

Logical Block Address; used to read or write device_address by its LBA. When reading, a negative device_offset is converted to an undefined LBA.

lba

Alias for start_lba

end_lba

Used to read or write size relative to device_address, in terms of block_size.

data

A reference to literal data of this file, which could be a scalar ref or LazyFileData object.

VERSION

version 0.005

AUTHOR

Michael Conrad <mike@nrdvana.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Michael Conrad.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.