///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
// Returns the number of free space (in bytes) on a partition bounded 
// by head and tail
integer wasPrimFSGetFreeSpace(integer head, integer tail) {
    integer occupied = 0;
    integer seek = tail;
    do {
        occupied += llStringLength(wasGetLinkDescription(seek));
    } while(--seek>=head);
    return BYTES_PER_SECTOR*(tail-head)-occupied;
}