<< Previous | Next >>

fs_setup (FS2)

FSLXnum fs_setup( FSLXnum lxn, word ls_shift, int reserve_it, void * rfu, int partition_it, word part, word part_ls_shift, int part_reserve, void * part_rfu );

Description

To modify or add to the default extents, this function must be called before calling fs_init(). If called after fs_init(), the filesystem will be corrupted.

fs_setup() runs in one of two basic modes, determined by the partition_it parameter. If partition_it is non-zero, then the specified extent (lxn, which must exist), is split into two extents according to the given proportions. If partition_it is zero, then the specified extent must not exist; it is created. This use is beyond the scope of this note, since it involves filesystem internals. The paritioning usage is described here.

partition_it may be FS_MODIFY_EXTENT in which case the base extent, lxn, is modified to use the specified ls_shift and reserve_it parameters (the other parameters are ignored).

partition_it may be set to FS_PARTITION_FRACTION (other values reserved). This causes extent number lxn to be split. The first half is still referred to as extent lxn, and the other half is assigned a new extent number, which is returned.

The base extent number may itself have been previously partitioned, or it should be 1 for the 2nd flash device, or possibly 2 for the NVRAM device.

Parameters

lxn
Base extent number to partition or modify.

ls_shift
New logical sector size to assign to base partition, or zero to not alter it. This is expressed as the log base 2 of the desired size, and must be a number between 6 and 13 inclusive.

reserve_it
TRUE if base partition is to be marked reserved.

rfu
A pointer reserved for future use. Pass as null.

partition_it
Must be set to FS_PARTITION_FRACTION or FS_MODIFY_EXTENT. The following parameters are ignored if this parameter is not FS_PARTITION_FRACTION.

part
The fraction of the existing base extent to assign to the new extent. This number is expressed as a fixed-point binary number with the binary point to the left of the MSB e.g. 0x3000 assigns 3/16 of the base extent to the new partition, updating the base extent to 13/16 of its original size. The nearest whole number of physical sectors is used for each extent.

part_ls_shift
Logical sector size to assign to the new extent, or zero to use the same LS size as the base extent. Expressed in same units as parameter 2.

part_reserve
TRUE if the new extent is to be reserved.

part_rfu
A pointer reserved for future use. Pass as null.

Return value

 0: Failure, extent could not be partitioned.
!0: Success, number of the new extent, or same as lxd for existing extent modification.

ERRNO values

ENOSPC - one or other half would contain an unusably small number of logical sectors, or the extent table is full. In the latter case, #define FS_MAX_LX to a larger value.

EINVAL - partition_it set to an invalid value, or other parameter invalid.

ENODEV - specified base extent number not defined.

Library

FS2.LIB

See also

fs_init (FS2)


Dynamic C Functions << Previous | Next >> rabbit.com