source file src/include/surprise/partition.h
block_t getsize_struct(block_t)
Input pars:
size of disk space covered by required changes in
consequent call convert()
Output pars:
none
Actions:
computes size of the necessary structures for GConv
conversion on given count of blocks
Memory alloc:
none
Memory free:
none
Return value:
computed sizeint convert(size_t impnum, struct partition *imported, size_t expnum, struct partition *exported, size_t spcnum, struct space *free_space, int badblock_check, PROGRESS_PARAM, ERR_PARAM)
Input pars:
number of imported partition, imported partitions,
number of exported partitions, exported partitions, number of free spaces,
free spaces, flag how to check on bad blocks (one of BADBLOCK_CHECK_*)
Output pars:
none, fills few items in imported, exported
partitions and free space
Actions:
converts given beginning state described as imported
partitions to final state desribed as exported partition with usage free
space, this includes check on bad blocks (depends on parameter)
Memory alloc:
none
Memory free:
none
Return value:
zero iff successint convert_move(struct partition *imported, struct partition *exported, int badblock_check, PROGRESS_PARAM, ERR_PARAM)
Input pars:
imported and exported partition (guaranteed difference
only in location), level of checking badblocks (one of BADBLOCK_CHECK_*)
Output pars:
none
Action:
moves partition from imported to exported location,
possible move across devices, includes check on bad blocks
Memory alloc:
none
Memory free:
none
Return value:
zero if success, negative if errorint convert_create(size_t num, struct partition *exported, int badblock_check, PROGRESS_PARAM, ERR_PARAM)
Input pars:
number of exported partitions, exported partitions,
level of checking on bad blocks
Output pars:
none
Actions:
creates new empty described partitions
Memory alloc:
none
Memory free:
none
Return value:
zero if success, negative if errorint fill_zero(int fh, struct partition_base *base, PROGRESS_PARAM, ERR_PARAM)
int fill_zero(int fh, struct partition_base *base, PROGRESS_PARAM, ERR_PARAM)
int secure_erasure(int fh, struct partition_base *base, PROGRESS_PARAM, ERR_PARAM)
Input pars:
device handle, interval of blocks on device
Output pars:
none
Actions:
fills blocks with zeroes
Memory alloc:
none
Memory free:
none
Return value:
zero if success, negative if errorint secure_erasure(int fh, struct partition_base *base, PROGRESS_PARAM, ERR_PARAM)
Input pars:
device handle, interval of blocks on device
Output pars:
none
Actions:
securely erases data in blocksMemory alloc:
none
Memory free:
none
Return value:
zero if success, negative if error
These functions provide block interface for read/write operations on imported and also on exported partition and are intended for use in filesystem modules.
Note given position is always relative to the beginning of given partition and must be inside the partition. Provides block or byte oriented access, both accesses can be mixed. You should know that byte-oriented access is emulated by block oriented access.
block_t bread(struct partition *part, const struct extent *blocks, void *buf, ERR_PARAM)
Input pars:
source partition, extent of blocks
Output pars:
buf - destination buffer
Actions:
reads extent from partition into buffer
Memory alloc:
none
Memory free:
none
Return value:
number of read blocksblock_t bwrite(struct partition *part, const struct extent *blocks, const void *buf, ERR_PARAM)
Input pars:
destination partition, extent of blocks, source buffer
Output pars:
none
Actions:
writes buffer to extent in partition
Memory alloc:
none
Memory free:
none
Return value:
number of written blockssec1off_t bread1(struct partition *part, sec1off_t index, sec1off_t count, void *buf, ERR_PARAM)
Input pars:
source partition, first byte and number bytes to read
Output pars:
buf - destination buffer
Actions:
reads specified bytes from partition into buffer
Memory alloc:
none
Memory free:
none
Return value:
number of read bytessec1off_t bwrite1(struct partition *part, sec1off_t index, sec1off_t count, const void *buf, ERR_PARAM)
Input pars:
destination partition, first byte and number bytes to write, source buffer
Output pars:
none
Actions:
writes buffer to specified bytes in partition
Memory alloc:
none
Memory free:
none
Return value:
number of written bytes
API is found in file src/include/surprise/fs.h and implementation in src/libsurprise/gconv/brw.c