[Cbe-oss-dev] [PATCH] spufs: Return EOPNOTSUPP if affinity isn't supported

Kazunori Asayama asayama at sm.sony.co.jp
Tue Oct 2 18:00:14 EST 2007


The libspe2 spec says that the library returns a specific errno
ENOTSUP when the platform doesn't support affinity, however there is
no way to know this error reason by the userspace because the current
SPUFS implementation doesn't distinguish this case from other generic
errors and returns EINVAL. This patch changes the spu_create system
call's behavior so that it returns EOPNOTSUPP in this case.

Essentially, ENOTSUP should be returned here (EOPNOTSUPP means
"Operation not supported on socket"), however I use EOPNOTSUPP instead
of ENOTSUP because 1) there is no definition of ENOTSUP in the Linux
kernel, 2) EOPNOTSUPP has the same value as ENOTSUP and they are not
distinct on the Linux userspace (see the man page of 'errno') and 3)
other drivers (ATA, USB, etc) also use EOPNOTSUPP for similar
purposes.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>

---
 arch/powerpc/platforms/cell/spufs/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- a/arch/powerpc/platforms/cell/spufs/inode.c	2007-09-19 15:48:55.000000000 +0900
+++ b/arch/powerpc/platforms/cell/spufs/inode.c	2007-09-19 22:47:31.000000000 +0900
@@ -328,7 +328,7 @@ spufs_assert_affinity(unsigned int flags
 					struct spu, cbe_list))->aff_list);
 
 	if (!aff_supp)
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-EOPNOTSUPP);
 
 	if (flags & SPU_CREATE_GANG)
 		return ERR_PTR(-EINVAL);



More information about the cbe-oss-dev mailing list