/* GNU fdisk - a clone of Linux fdisk. Copyright (C) 2006 Free Software Foundation, Inc. This program 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 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; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA*/#ifndef FUNCTION_H_INCLUDED#define FUNCTION_H_INCLUDED#include <parted/parted.h>#include "../src/common.h"#define DEFAULT_STRING "RESERVED"#define BUFSIZE 4093/* The names of the tempfiles */externconstchar*tempfile_name();externconstchar*tempfile2_name();/* We have our device here */externPedDevice*dev;externPedDisk*disk;externUICallsuiquery;/* Random seed */externintseed;externvoidset_seed(int);/* TODO: Substitute this in the code and remove these, when finalized */#define srand(x) set_seed(x)#define rand() rand_r(&seed)/* We will use common exception handling for tests */externPedExceptionOptionex_opts;externPedExceptionTypeex_type;externPedExceptionOptionexception_handler(PedException*);externvoidtest_exception();/* This are functions for UICalls *//* NOTE: This macros are only for reference */#define PUT_STRING(x) string[0][BUFSIZE] = 0; \ uiquery.getstring = getstring; \ strncpy(string[0], x, BUFSIZE-1)#define PUT_TWO_STRINGS(x,y) string[0][BUFSIZE] = 2; \ uiquery.getstring = getstring; \ strncpy(string[0], x, BUFSIZE-1); \ strncpy(string[1], y, BUFSIZE-1)externcharstring[2][BUFSIZE+1];externintstring_gets;externintgetstring(constchar*prompt,char**val,constStrList*str_list,constStrList*loc_str_list,intmulti_word);externintinteger;externintgetint(constchar*prompt,int*value);externintbool;externintgetbool(constchar*prompt,int*value);externPedDevice*device;externintgetdev(constchar*prompt,PedDevice**value);externPedPartition*partition;externintgetpart(constchar*prompt,PedDisk**disk,PedPartition**value);externPedDiskType*disk_type;externintgetdisktype(constchar*prompt,PedDiskType**value);externPedFileSystemType*fs_type;externintgetfstype(constchar*prompt,PedFileSystemType**value);#define POS_POSS_SIZE 10externintpartpos;externintpos_gets;externcharpos_poss[POS_POSS_SIZE];externintgetpartpos(constchar*prompt,constvoid*context,constchar*possibilities);/* Device init functions, we should make them one */externintinit_tempfile();externvoidunlink_tempfile();externintopen_device();/* Other functions */externintare_near(longlonga,longlongb);/*extern long long llrand();*//* Common check things for both test programs */externvoidnext_part_geometry(PedGeometry**,PedConstraint*,intfactor);/* This one takes the partition making function as a parameter * * We use the fact that mkpart and mkpartfs take the same params */externint_mkpart(inthow,PedSectorstart,PedSectorend,PedPartitionTypetype,constPedFileSystemType*fs_type,PedPartition**newpart,intmkpart(PedDisk*,PartPos*pos,PedPartitionType,constPedFileSystemType*,PedPartition**,UIOpts));/* This is a function that both resizes and moves */externint_resmov(inthow,PedPartition*part,PedSectorstart,PedSectorend,UIOptsopts,intaction(PedDisk*,PedPartition*,PartPos*pos,UIOpts));externvoidget_max_geometry(PedGeometry**geom,PedConstraint*constraint,PedPartition*part);externvoidrandomize_position(PedSector*start,PedSector*end,PedGeometry*where,inti);externvoidchange_size(constchar*label_type,UIOptsopts);#endif