/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* aux function for <ls.h> iblocks() macro
*
* return number of blocks, including indirect block count
* given stat info
*
* mail gsf@research.att.com when you figure out the stat.st_blocks units
* until then we assume LS_BLOCKSIZE (512)
*/
#include <ast.h>
#if _AIX /* XXX */
#endif
#include <ast_param.h>
#include <ls.h>
#if !_mem_st_blocks_stat
#ifndef B_DIRECT
#endif
#ifdef BITFS
#else
#ifdef BSIZE
#else
#endif
#ifdef NINDIR
#else
#endif
#endif
#endif
{
#else
unsigned long b;
unsigned long t;
if ((b -= B_DIRECT) > 0)
{
if ((b -= B_INDIRECT) > 0)
{
if (b > B_INDIRECT * B_INDIRECT)
t++;
}
}
return t * B_SIZE / LS_BLOCKSIZE;
#endif
}