[PATCH] s390: getdents patch for 32 -> 64 converter

From: Sripathi Kodi
Date: Tue Feb 01 2005 - 04:44:02 EST


Hi,

This patch solves a problem with working of getdents while using 32 bit binaries on 64 bit Linux/390. glibc expects d_type to be passed if we have a kernel version after 2.6.4, so we have to also handle it in the 32bit syscall converter. Similar patch was given for PPC by Marcus Meissner (http://ozlabs.org/pipermail/linuxppc64-dev/2004-March/001359.html) and was integrated into 2.6.5.

Thanks,
Sripathi.

Signed-off-by: Sripathi Kodi <sripathik@xxxxxxxxxx>

--- linux-2.6.10/arch/s390/kernel/compat_linux.c 2004-12-25 03:05:24.000000000 +0530
+++ /home/sripathi/12795/mainline/compat_linux.c 2005-02-01 14:06:33.000000000 +0530
@@ -433,7 +433,7 @@ static int filldir(void * __buf, const c
{
struct linux_dirent32 * dirent;
struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
- int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+ int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);

buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
@@ -447,6 +447,7 @@ static int filldir(void * __buf, const c
put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen);
+ put_user(d_type, (char *) dirent + reclen - 1);
buf->current_dir = ((void *)dirent) + reclen;
buf->count -= reclen;
return 0;