int uffs_rmdir(const char *name)
{
	int err = 0;
	int ret = 0;
	struct uffs_stat st;

	if (uffs_stat(name, &st) < 0) {
		err = UENOENT;
		ret = -1;
	}
	else if ((st.st_mode & US_IFDIR) == 0) {
		err = UENOTDIR;
		ret = -1;
	}
	else {
		uffs_GlobalFsLockLock();
		if (uffs_DeleteObject(name, &err) == U_SUCC) {
			ret = 0;
		}
		else {
			ret = -1;
		}
		uffs_GlobalFsLockUnlock();
	}
	uffs_set_error(-err);
	return ret;
}
Example #2
0
//Delete a File or Directory
int dfs_uffs_unlink(struct dfs_filesystem* fs, const char* path)   
{
	int ret;
	int err = 0;

	ret = uffs_DeleteObject(path, &err);
	uffs_set_error(-err);

	return ret;   
}      
Example #3
0
int uffs_remove(const char *name)
{
    int err = 0;
    int ret = 0;
    struct uffs_stat st;

    if (uffs_stat(name, &st) < 0) {
        err = UENOENT;
        ret = -1;
    } else if (st.st_mode & US_IFDIR) {
        err = UEISDIR;
        ret = -1;
    } else if (uffs_DeleteObject(name, &err) == U_SUCC) {
        ret = 0;
    } else {
        ret = -1;
    }

    uffs_set_error(-err);
    return ret;
}