diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index e69de29b..043dea09 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -0,0 +1,82 @@ +/* + * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program/include file is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +//#include +//#include +//#include + +#include + +#include "types.h" +#include "attrib.h" +#include "runlist.h" +#include "volume.h" +#include "lcnalloc.h" + +//#include "debug.h" + +/** + * ntfs_cluster_alloc - allocate clusters on an ntfs volume + * @vol: mounted ntfs volume on which to allocate the clusters + * @count: number of clusters to allocate + * @start_lcn: starting lcn at which to allocate the clusters (or -1 if none) + * + * Allocate @count clusters starting at cluster @start_lcn or at the current + * allocator position if @start_lcn is -1, from the mounted ntfs volume @vol. + * + * On success return a runlist describing the allocated cluster(s). + * + * On error return NULL with errno set to the error code. + */ +runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn) +{ + if (!vol || count < 0 || start_lcn < 0 || !vol->lcnbmp_na) { + errno = EINVAL; + return NULL; + } + + errno = ENOTSUP; + return NULL; +} + +/** + * ntfs_cluster_free - free clusters on an ntfs volume + * @vol: mounted ntfs volume on which to free the clusters + * @rl: runlist describing the clusters to free + * @start_vcn: starting relative vcn into @rl at which to free the clusters + * @count: number of clusters to free + * + * Allocate @count clusters starting at cluster @start_lcn or at the current + * allocator position if @start_lcn is -1, from the mounted ntfs volume @vol. + * + * On success return 0 and -1 on error with errno set to the error code. + */ +int ntfs_cluster_free(ntfs_volume *vol, runlist *rl, VCN start_vcn, s64 count) +{ + if (!vol || !rl || start_vcn < 0 || count < 0 || !vol->lcnbmp_na) { + errno = EINVAL; + return -1; + } + + errno = ENOTSUP; + return -1; +} +