X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=119751843f0ae9d4b9225b5fa96d265fdf191ef9;hb=d8ff7698762028c417be5dbc102fe882be0f99c5;hp=6206ed427bb7dff99a9e176c1d049ed4cc61febc;hpb=40c386c7a14ebfa8afc14562f3b33a416831b26d;p=yaffs2.git diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 6206ed4..1197518 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -24,7 +24,7 @@ #endif -const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.20 2008-07-02 20:17:41 charles Exp $"; +const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.21 2008-07-03 20:06:05 charles Exp $"; // configurationList is the list of devices that are supported static yaffsfs_DeviceConfiguration *yaffsfs_configurationList; @@ -1602,6 +1602,28 @@ loff_t yaffs_totalspace(const YCHAR *path) return retVal; } +int yaffs_inodecount(const YCHAR *path) +{ + loff_t retVal= -1; + yaffs_Device *dev=NULL; + YCHAR *dummy; + + yaffsfs_Lock(); + dev = yaffsfs_FindDevice(path,&dummy); + if(dev && dev->isMounted) { + int nObjects = dev->nObjectsCreated - dev->nFreeObjects; + if(nObjects > dev->nHardLinks) + retVal = nObjects - dev->nHardLinks; + } + + if(retVal < 0){ + yaffsfs_SetError(-EINVAL); + } + + yaffsfs_Unlock(); + return retVal; +} + void yaffs_initialise(yaffsfs_DeviceConfiguration *cfgList)