Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
[yaffs2.git] / direct / yaffsfs.c
index 6206ed427bb7dff99a9e176c1d049ed4cc61febc..119751843f0ae9d4b9225b5fa96d265fdf191ef9 100644 (file)
@@ -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)