return a;
}
-int yaffsfs_Match(YCHAR a, YCHAR b)
+static int yaffsfs_Match(YCHAR a, YCHAR b)
{
return (yaffs_toupper(a) == yaffs_toupper(b));
}
#else
-int yaffsfs_Match(YCHAR a, YCHAR b)
+static int yaffsfs_Match(YCHAR a, YCHAR b)
{
/* case sensitive */
return (a == b);
}
#endif
-int yaffsfs_IsPathDivider(YCHAR ch)
+static int yaffsfs_IsPathDivider(YCHAR ch)
{
const YCHAR *str = YAFFS_PATH_DIVIDERS;
return 0;
}
-int yaffsfs_CheckNameLength(const char *name)
+static int yaffsfs_CheckNameLength(const char *name)
{
int retVal = 0;
YAFFS_SHARE_READ | YAFFS_SHARE_WRITE);
}
-int yaffs_Dofsync(int handle, int datasync)
+static int yaffs_Dofsync(int handle, int datasync)
{
int retVal = -1;
struct yaffs_obj *obj;
return retVal;
}
-int yaffsfs_do_read(int handle, void *vbuf, unsigned int nbyte,
+static int yaffsfs_do_read(int handle, void *vbuf, unsigned int nbyte,
int isPread, Y_LOFF_T offset)
{
struct yaffsfs_FileDes *fd = NULL;
return yaffsfs_do_read(handle, buf, nbyte, 1, offset);
}
-int yaffsfs_do_write(int handle, const void *vbuf, unsigned int nbyte,
+static int yaffsfs_do_write(int handle, const void *vbuf, unsigned int nbyte,
int isPwrite, Y_LOFF_T offset)
{
struct yaffsfs_FileDes *fd = NULL;
return pos;
}
-int yaffsfs_DoUnlink(const YCHAR *path, int isDirectory)
+static int yaffsfs_DoUnlink(const YCHAR *path, int isDirectory)
{
struct yaffs_obj *dir = NULL;
struct yaffs_obj *obj = NULL;
return yaffs_unmount2(path, 0);
}
+int yaffs_format(const YCHAR *path,
+ int unmount_flag,
+ int force_unmount_flag,
+ int remount_flag)
+{
+ int retVal = 0;
+ struct yaffs_dev *dev = NULL;
+ int result;
+
+ if (!path) {
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
+ if (yaffsfs_CheckPath(path) < 0) {
+ yaffsfs_SetError(-ENAMETOOLONG);
+ return -1;
+ }
+
+ yaffsfs_Lock();
+ dev = yaffsfs_FindMountPoint(path);
+
+ if (dev) {
+ int was_mounted = dev->is_mounted;
+
+ if (dev->is_mounted && unmount_flag) {
+ int inUse;
+ yaffs_flush_whole_cache(dev);
+ yaffs_checkpoint_save(dev);
+ inUse = yaffsfs_IsDevBusy(dev);
+ if (!inUse || force_unmount_flag) {
+ if (inUse)
+ yaffsfs_BreakDeviceHandles(dev);
+ yaffs_deinitialise(dev);
+ }
+ }
+
+ if(dev->is_mounted) {
+ yaffsfs_SetError(-EBUSY);
+ retVal = -1;
+ } else {
+ yaffs_format_dev(dev);
+ if(was_mounted && remount_flag) {
+ result = yaffs_guts_initialise(dev);
+ if (result == YAFFS_FAIL) {
+ yaffsfs_SetError(-ENOMEM);
+ retVal = -1;
+ }
+ }
+ }
+ } else {
+ yaffsfs_SetError(-ENODEV);
+ retVal = -1;
+ }
+
+ yaffsfs_Unlock();
+ return retVal;
+
+}
+
+
Y_LOFF_T yaffs_freespace(const YCHAR *path)
{
Y_LOFF_T retVal = -1;
int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev)
{
- pathname = pathname;
- mode = mode;
- dev = dev;
+ (void) pathname;
+ (void) mode;
+ (void) dev;
yaffsfs_SetError(-EINVAL);
return -1;
int yaffs_dump_dev(const YCHAR *path)
{
#if 1
- path = path;
+ (void) path;
#else
YCHAR *rest;