yaffs Fix xattr error codes
authorCharles Manning <cdhmanning@gmail.com>
Thu, 1 Jul 2010 01:41:16 +0000 (13:41 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Thu, 1 Jul 2010 01:41:16 +0000 (13:41 +1200)
There were some incorrect error codes.
Now returns
ENODATA if an object does not have the requested xattr.
ERANGE if the buffer is too small to accept the requested xattr.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffsfs.h
yaffs_guts.c
yaffs_nameval.c

index db983f1e4a2176e709fd54202930504f36806a40..fc9bb9eb158897eec4538e835d8a650844b2fe10 100644 (file)
 #define ENOSPC 28
 #endif
 
+#ifndef ERANGE
+#define ERANGE 34
+#endif
+
+#ifndef ENODATA
+#define ENODATA 61
+#endif
+
 #ifndef ENOTEMPTY
 #define ENOTEMPTY 39
 #endif
index 604dc0910af9301d9b70d2feb304a9d9b1559b12..84d14c94a7fbb5583a36ddf28790b8fe1a56bf68 100644 (file)
@@ -7516,7 +7516,7 @@ static int yaffs_DoXFetch(yaffs_Object *obj, const char *name, void *value, int
        int retval = 0;
 
        if(obj->hdrChunk < 1)
-               return -ENOENT;
+               return -ENODATA;
 
        buffer = yaffs_GetTempBuffer(dev, __LINE__);
        if(!buffer)
index e15b647196eb316994a46e83fc8bee7501c446eb..4835ccfeff6dd99c9629c75d872acbf072141fcc 100644 (file)
@@ -80,7 +80,7 @@ int nval_del(char *xb, int xb_size, const char *name)
                memset(xb + (xb_size - size),0,size);
                return 0;
        } else
-               return -ENOENT;
+               return -ENODATA;
 }
 
 int nval_set(char *xb, int xb_size, const char *name, const char *buf, int bsize, int flags)
@@ -97,7 +97,7 @@ int nval_set(char *xb, int xb_size, const char *name, const char *buf, int bsize
        if(flags & XATTR_CREATE && pos >= 0)
                return -EEXIST;
        if(flags & XATTR_REPLACE && pos < 0)
-               return -ENOENT;
+               return -ENODATA;
 
        start = nval_used(xb,xb_size);
        space = xb_size - start + size_exist;
@@ -148,7 +148,10 @@ int nval_get(const char *xb, int xb_size, const char *name, char *buf, int bsize
                }
                
        }
-       return -ENOENT;
+       if(pos >= 0)
+               return -ERANGE;
+       else
+               return -ENODATA;
 }
 
 int nval_list(const char *xb, int xb_size, char *buf, int bsize)