Module Name: src Committed By: chs Date: Sat Sep 11 20:53:04 UTC 2010
Modified Files: src/sys/compat/linux/common: linux_dirent.h linux_misc.c src/sys/compat/linux32/common: linux32_dirent.c linux32_types.h Log Message: recent versions of linux (which we now claim to be) supply a BSD-style d_type value in getdents() results, after the d_name field. make our emulation do the same. fixes part of PR 43695. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux/common/linux_dirent.h cvs rdiff -u -r1.216 -r1.217 src/sys/compat/linux/common/linux_misc.c cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux32/common/linux32_dirent.c cvs rdiff -u -r1.12 -r1.13 src/sys/compat/linux32/common/linux32_types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/linux/common/linux_dirent.h diff -u src/sys/compat/linux/common/linux_dirent.h:1.11 src/sys/compat/linux/common/linux_dirent.h:1.12 --- src/sys/compat/linux/common/linux_dirent.h:1.11 Mon Apr 28 20:23:43 2008 +++ src/sys/compat/linux/common/linux_dirent.h Sat Sep 11 20:53:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_dirent.h,v 1.11 2008/04/28 20:23:43 martin Exp $ */ +/* $NetBSD: linux_dirent.h,v 1.12 2010/09/11 20:53:04 chs Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ linux_ino_t d_ino; linux_off_t d_off; u_short d_reclen; - char d_name[LINUX_MAXNAMLEN + 1]; + char d_name[LINUX_MAXNAMLEN + 2]; }; struct linux_dirent64 { @@ -51,6 +51,6 @@ #define LINUX_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)(dp)) -#define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 1)) +#define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 2)) #endif /* !_LINUX_DIRENT_H */ Index: src/sys/compat/linux/common/linux_misc.c diff -u src/sys/compat/linux/common/linux_misc.c:1.216 src/sys/compat/linux/common/linux_misc.c:1.217 --- src/sys/compat/linux/common/linux_misc.c:1.216 Wed Jul 7 01:30:35 2010 +++ src/sys/compat/linux/common/linux_misc.c Sat Sep 11 20:53:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.216 2010/07/07 01:30:35 chs Exp $ */ +/* $NetBSD: linux_misc.c,v 1.217 2010/09/11 20:53:04 chs Exp $ */ /*- * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.216 2010/07/07 01:30:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.217 2010/09/11 20:53:04 chs Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -779,6 +779,7 @@ idb.d_reclen = (u_short)linux_reclen; } strcpy(idb.d_name, bdp->d_name); + idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type; if ((error = copyout((void *)&idb, outp, linux_reclen))) goto out; /* advance past this real entry */ Index: src/sys/compat/linux32/common/linux32_dirent.c diff -u src/sys/compat/linux32/common/linux32_dirent.c:1.11 src/sys/compat/linux32/common/linux32_dirent.c:1.12 --- src/sys/compat/linux32/common/linux32_dirent.c:1.11 Thu Jun 24 13:03:07 2010 +++ src/sys/compat/linux32/common/linux32_dirent.c Sat Sep 11 20:53:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_dirent.c,v 1.11 2010/06/24 13:03:07 hannken Exp $ */ +/* $NetBSD: linux32_dirent.c,v 1.12 2010/09/11 20:53:04 chs Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux32_dirent.c,v 1.11 2010/06/24 13:03:07 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_dirent.c,v 1.12 2010/09/11 20:53:04 chs Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -213,6 +213,7 @@ idb.d_reclen = (u_short)linux32_reclen; } strcpy(idb.d_name, bdp->d_name); + idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type; if ((error = copyout((void *)&idb, outp, linux32_reclen))) goto out; /* advance past this real entry */ Index: src/sys/compat/linux32/common/linux32_types.h diff -u src/sys/compat/linux32/common/linux32_types.h:1.12 src/sys/compat/linux32/common/linux32_types.h:1.13 --- src/sys/compat/linux32/common/linux32_types.h:1.12 Wed Jul 7 01:30:36 2010 +++ src/sys/compat/linux32/common/linux32_types.h Sat Sep 11 20:53:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_types.h,v 1.12 2010/07/07 01:30:36 chs Exp $ */ +/* $NetBSD: linux32_types.h,v 1.13 2010/09/11 20:53:04 chs Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -120,7 +120,7 @@ linux32_ino_t d_ino; linux32_off_t d_off; u_short d_reclen; - char d_name[LINUX32_MAXNAMLEN + 1]; + char d_name[LINUX32_MAXNAMLEN + 2]; }; #endif /* !_LINUX32_TYPES_H */