From 196cd2318144d4de74087e318f312c8ab6d77770 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Thu, 1 Jul 2010 13:41:16 +1200 Subject: [PATCH] yaffs Fix xattr error codes 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 --- direct/yaffsfs.h | 8 ++++++++ yaffs_guts.c | 2 +- yaffs_nameval.c | 9 ++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/direct/yaffsfs.h b/direct/yaffsfs.h index db983f1..fc9bb9e 100644 --- a/direct/yaffsfs.h +++ b/direct/yaffsfs.h @@ -110,6 +110,14 @@ #define ENOSPC 28 #endif +#ifndef ERANGE +#define ERANGE 34 +#endif + +#ifndef ENODATA +#define ENODATA 61 +#endif + #ifndef ENOTEMPTY #define ENOTEMPTY 39 #endif diff --git a/yaffs_guts.c b/yaffs_guts.c index 604dc09..84d14c9 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -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) diff --git a/yaffs_nameval.c b/yaffs_nameval.c index e15b647..4835ccf 100644 --- a/yaffs_nameval.c +++ b/yaffs_nameval.c @@ -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) -- 2.30.2