From 1c283737c57af38f5cd3bb23e121d13a4429902a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 20:02:16 +0000 Subject: [PATCH] Change prototype of ntfs_cluster_alloc like in kernel driver. (Logical change 1.628) --- include/ntfs/lcnalloc.h | 4 ++-- libntfs/attrib.c | 17 +++++++++-------- libntfs/lcnalloc.c | 6 +++--- libntfs/mft.c | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h index ae3e1dfb..0063b575 100644 --- a/include/ntfs/lcnalloc.h +++ b/include/ntfs/lcnalloc.h @@ -35,8 +35,8 @@ typedef enum { LAST_ZONE = 1, /* For sanity checking. */ } NTFS_CLUSTER_ALLOCATION_ZONES; -extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn); +extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, + LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone); extern int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 87b190a6..73900b91 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1133,9 +1133,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } } /* Allocate clusters to instantiate the hole. */ - rlc = ntfs_cluster_alloc(vol, ((ofs + to_write - 1) >> - vol->cluster_size_bits) + 1, - lcn_seek_from, DATA_ZONE, rl->vcn); + rlc = ntfs_cluster_alloc(vol, rl->vcn, + ((ofs + to_write - 1) >> + vol->cluster_size_bits) + 1, + lcn_seek_from, DATA_ZONE); if (!rlc) { eo = errno; Dprintf("%s(): Failed to allocate clusters for " @@ -3146,8 +3147,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (new_allocated_size > 0) { /* Start by allocating clusters to hold the attribute value. */ - rl = ntfs_cluster_alloc(vol, new_allocated_size >> - vol->cluster_size_bits, -1, DATA_ZONE, 0); + rl = ntfs_cluster_alloc(vol, 0, new_allocated_size >> + vol->cluster_size_bits, -1, DATA_ZONE); if (!rl) { if (errno != ENOSPC) { int eo = errno; @@ -4248,11 +4249,11 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) lcn_seek_from = rl->lcn + rl->length; } - rl = ntfs_cluster_alloc(vol, first_free_vcn - + rl = ntfs_cluster_alloc(vol, na->allocated_size >> + vol->cluster_size_bits, first_free_vcn - (na->allocated_size >> vol->cluster_size_bits), lcn_seek_from, - DATA_ZONE, na->allocated_size >> - vol->cluster_size_bits); + DATA_ZONE); if (!rl) { err = errno; Dprintf("%s(): Eeek! Cluster allocation " diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index dc561d80..e72383a5 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -37,10 +37,10 @@ /** * ntfs_cluster_alloc - allocate clusters on an ntfs volume * @vol: mounted ntfs volume on which to allocate the clusters + * @start_vcn: vcn to use for the first allocated cluster * @count: number of clusters to allocate * @start_lcn: starting lcn at which to allocate the clusters (or -1 if none) * @zone: zone from which to allocate the clusters - * @start_vcn: * * Allocate @count clusters preferably starting at cluster @start_lcn or at the * current allocator position if @start_lcn is -1, on the mounted ntfs volume @@ -90,8 +90,8 @@ * possible code paths. So at least for now, I am leaving the double logic - * better safe than sorry... (AIA) */ -runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn) +runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, + LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone) { LCN zone_start, zone_end, bmp_pos, bmp_initial_pos, last_read_pos, lcn; LCN prev_lcn = 0, prev_run_len = 0, mft_zone_size; diff --git a/libntfs/mft.c b/libntfs/mft.c index a65efe80..f93829e9 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -595,7 +595,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ntfs_debug("Appending one cluster to mft bitmap."); } else { /* Allocate a cluster from the DATA_ZONE. */ - rl2 = ntfs_cluster_alloc(vol, 1, lcn, DATA_ZONE, rl[1].vcn); + rl2 = ntfs_cluster_alloc(vol, rl[1].vcn, 1, lcn, DATA_ZONE); if (!rl2) { ntfs_error(vol->sb, "Failed to allocate a cluster for " "the mft bitmap."); @@ -907,7 +907,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) "%lli.", (long long)nr); old_last_vcn = rl[1].vcn; do { - rl2 = ntfs_cluster_alloc(vol, nr, lcn, MFT_ZONE, old_last_vcn); + rl2 = ntfs_cluster_alloc(vol, old_last_vcn, nr, lcn, MFT_ZONE); if (rl2) break; if (errno != ENOSPC || nr == min_nr) {