head	1.1;
access;
symbols;
locks
	dfk:1.1; strict;
comment	@# @;


1.1
date	96.07.20.03.44.04;	author dfk;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@#!/bin/csh -f
#
# config-one:
#   make a dmcache configuration for a set of parameters.
# This takes a few steps
#
# -  combine the parameters into a directory name
#
# -  if the directory does not exist,
#   	make the directory
#   	link GraphFile, ConfigFile, ParamHelp to the new directory
#   	copy the *.param files to the new directory
#
#######
#
set usage='config-one recsize file-maxblocks iopfs sorting layout Ndisk [filter%]' 
#
#
# Part of
#              The STARFISH Parallel file-system simulator
#        (Simulation Tool for Advanced Research in File Systems)
# 
#                               David Kotz
#                           Dartmouth College
#                              Version 2.0
#                              January 1995
#                          dfk@@cs.dartmouth.edu

if ($#argv != 6 && $#argv != 7) then
    echo "$usage"
    exit 1
endif

onintr cleanup

set recsize=$1
set fileblocks=$2
set iopfs=$3
set sort=$4
set layout=$5
set Ndisk=$6
if ($#argv == 6) then
    set filter=0
else
    set filter=$7
endif

set dirname=configs/$recsize.$fileblocks.$iopfs.$sort.$layout.$Ndisk.$filter

echo $dirname
if (-d $dirname) exit 

mkdir $dirname
ln -s ../../base/{Configfile,ParamHelp} $dirname/
cp base/*.param $dirname/
chmod +w $dirname/*.param

cd $dirname
echo $dirname

# NOT ALL PARAMS can be set this way...
# and here I assume that base is set to have all options #undef
# among the sort, iopfs, cpfs, and layout choices

switch ($iopfs)
case cache:
    setparam IOP_CACHE  true iopfs.param
    setparam CP_NONE    true cpfs.param
    breaksw

case general:
    setparam IOP_GENERAL true iopfs.param
    setparam CP_DIRECT   true cpfs.param
    setparam TWO_PHASE	false cpfs.param
    breaksw

default:
    echo iopfs $iopfs not supported
    exit 1
    breaksw
endsw

switch ($sort)
case sort:
    setparam DISK_SORT true diskmodel.param
    breaksw
case nosort:
#    setparam DISK_SORT false diskmodel.param
    breaksw
default:
    echo sort $sort not supported
    exit 1
    breaksw
endsw

switch ($layout)
case contig:
    setparam LAYOUT_CONTIGUOUS true diskmodel.param
    breaksw
case rsectors:
    setparam LAYOUT_RANDOM_SECTORS true diskmodel.param
    breaksw
case rtracks:
    setparam LAYOUT_RANDOM_TRACKS true diskmodel.param
    breaksw
default:
    echo layout $layout not supported
    exit 1
    breaksw
endsw

setparam RECORD_SIZE $recsize file.param

setparam FILE_BLOCKS_MAX $fileblocks file.param
setparam NO_OF_DISKS $Ndisk disk.param

setparam FILTER_PERCENT $filter iopfs.param

# setparam IOP_AHEAD_BEHIND false iopfs.param

cd ../..
# domake-one $dirname
@
