]> git.sur5r.net Git - u-boot/blobdiff - fs/yaffs2/yaffsfs.c
configs: dragonboard410c: remove env partition offset
[u-boot] / fs / yaffs2 / yaffsfs.c
index 9f1397b578d365a0281dcb147ef0ce95a305745f..47abc6bedae7bf85c7eaea34dfdf1705065f297b 100644 (file)
  * published by the Free Software Foundation.
  */
 
+#include <div64.h>
 #include "yaffsfs.h"
 #include "yaffs_guts.h"
 #include "yaffscfg.h"
 #include "yportenv.h"
 #include "yaffs_trace.h"
 
-#include "string.h"
-
 #define YAFFSFS_MAX_SYMLINK_DEREFERENCES 5
 
 #ifndef NULL
@@ -1605,8 +1604,8 @@ static int yaffsfs_DoStat(struct yaffs_obj *obj, struct yaffs_stat *buf)
                buf->st_rdev = obj->yst_rdev;
                buf->st_size = yaffs_get_obj_length(obj);
                buf->st_blksize = obj->my_dev->data_bytes_per_chunk;
-               buf->st_blocks = (buf->st_size + buf->st_blksize - 1) /
-                   buf->st_blksize;
+               buf->st_blocks = lldiv(buf->st_size + buf->st_blksize - 1,
+                   buf->st_blksize);
 #if CONFIG_YAFFS_WINCE
                buf->yst_wince_atime[0] = obj->win_atime[0];
                buf->yst_wince_atime[1] = obj->win_atime[1];
@@ -2848,12 +2847,9 @@ static void yaffsfs_RemoveObjectCallback(struct yaffs_obj *obj)
         * the next one to prevent a hanging ptr.
         */
        list_for_each(i, &search_contexts) {
-               if (i) {
-                       dsc = list_entry(i, struct yaffsfs_DirSearchContxt,
-                                        others);
-                       if (dsc->nextReturn == obj)
-                               yaffsfs_DirAdvance(dsc);
-               }
+               dsc = list_entry(i, struct yaffsfs_DirSearchContxt, others);
+               if (dsc->nextReturn == obj)
+                       yaffsfs_DirAdvance(dsc);
        }
 
 }
@@ -3019,7 +3015,7 @@ int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath)
                yaffsfs_SetError(-ENFILE);
        else if (parent->my_dev->read_only)
                yaffsfs_SetError(-EROFS);
-       else if (parent) {
+       else {
                obj = yaffs_create_symlink(parent, name, mode, 0, 0, oldpath);
                if (obj)
                        retVal = 0;
@@ -3137,10 +3133,6 @@ int yaffs_link(const YCHAR *oldpath, const YCHAR *linkpath)
 
 int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev)
 {
-       pathname = pathname;
-       mode = mode;
-       dev = dev;
-
        yaffsfs_SetError(-EINVAL);
        return -1;
 }
@@ -3188,9 +3180,7 @@ int yaffs_set_error(int error)
 
 int yaffs_dump_dev(const YCHAR *path)
 {
-#if 1
-       path = path;
-#else
+#if 0
        YCHAR *rest;
 
        struct yaffs_obj *obj = yaffsfs_FindRoot(path, &rest);