1N/A/*
1N/A * runlist.h - Exports for runlist handling. Part of the Linux-NTFS project.
1N/A *
1N/A * Copyright (c) 2002 Anton Altaparmakov
1N/A * Copyright (c) 2002 Richard Russon
1N/A *
1N/A * This program/include file is free software; you can redistribute it and/or
1N/A * modify it under the terms of the GNU General Public License as published
1N/A * by the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program/include file is distributed in the hope that it will be
1N/A * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1N/A * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program (in the main directory of the Linux-NTFS
1N/A * distribution in the file COPYING); if not, write to the Free Software
1N/A * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1N/A */
1N/A
1N/A#ifndef _NTFS_RUNLIST_H
1N/A#define _NTFS_RUNLIST_H
1N/A
1N/A#include "types.h"
1N/A
1N/A/* Forward declarations */
1N/Atypedef struct _runlist_element runlist_element;
1N/Atypedef runlist_element runlist;
1N/A
1N/A#include "attrib.h"
1N/A#include "volume.h"
1N/A
1N/A/**
1N/A * struct _runlist_element - in memory vcn to lcn mapping array element.
1N/A * @vcn: starting vcn of the current array element
1N/A * @lcn: starting lcn of the current array element
1N/A * @length: length in clusters of the current array element
1N/A *
1N/A * The last vcn (in fact the last vcn + 1) is reached when length == 0.
1N/A *
1N/A * When lcn == -1 this means that the count vcns starting at vcn are not
1N/A * physically allocated (i.e. this is a hole / data is sparse).
1N/A */
1N/Astruct _runlist_element {/* In memory vcn to lcn mapping structure element. */
1N/A VCN vcn; /* vcn = Starting virtual cluster number. */
1N/A LCN lcn; /* lcn = Starting logical cluster number. */
1N/A s64 length; /* Run length in clusters. */
1N/A};
1N/A
1N/Aextern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
1N/A
1N/Aextern s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl,
1N/A const s64 pos, s64 count, void *b);
1N/Aextern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl,
1N/A const s64 pos, s64 count, void *b);
1N/A
1N/Aextern int ntfs_rl_fill_zero(const ntfs_volume *vol, const runlist *rl,
1N/A s64 pos, const s64 count);
1N/A
1N/Aextern runlist_element *ntfs_runlists_merge(runlist_element *drl,
1N/A runlist_element *srl);
1N/A
1N/Aextern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
1N/A const ATTR_RECORD *attr, runlist_element *old_rl);
1N/A
1N/Aextern int ntfs_get_nr_significant_bytes(const s64 n);
1N/A
1N/Aextern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
1N/A const runlist_element *rl, const VCN start_vcn);
1N/A
1N/Aextern int ntfs_write_significant_bytes(u8 *dst, const u8 *dst_max,
1N/A const s64 n);
1N/A
1N/Aextern int ntfs_mapping_pairs_build(const ntfs_volume *vol, u8 *dst,
1N/A const int dst_len, const runlist_element *rl,
1N/A const VCN start_vcn, VCN *const stop_vcn);
1N/A
1N/Aextern int ntfs_rl_truncate(runlist **arl, const VCN start_vcn);
1N/A
1N/Aextern int ntfs_rl_sparse(runlist *rl);
1N/Aextern s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl);
1N/A
1N/A#ifdef NTFS_TEST
1N/Aint test_rl_main(int argc, char *argv[]);
1N/A#endif
1N/A
1N/A#endif /* defined _NTFS_RUNLIST_H */
1N/A