Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat recent versions of linux (which we now claim to b...



details:   https://anonhg.NetBSD.org/src/rev/afd6ffe53944
branches:  trunk
changeset: 757677:afd6ffe53944
user:      chs <chs%NetBSD.org@localhost>
date:      Sat Sep 11 20:53:04 2010 +0000

description:
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.

diffstat:

 sys/compat/linux/common/linux_dirent.h     |  6 +++---
 sys/compat/linux/common/linux_misc.c       |  5 +++--
 sys/compat/linux32/common/linux32_dirent.c |  5 +++--
 sys/compat/linux32/common/linux32_types.h  |  4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diffs (96 lines):

diff -r af96255ac34b -r afd6ffe53944 sys/compat/linux/common/linux_dirent.h
--- a/sys/compat/linux/common/linux_dirent.h    Sat Sep 11 20:49:28 2010 +0000
+++ b/sys/compat/linux/common/linux_dirent.h    Sat Sep 11 20:53:04 2010 +0000
@@ -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 */
diff -r af96255ac34b -r afd6ffe53944 sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c      Sat Sep 11 20:49:28 2010 +0000
+++ b/sys/compat/linux/common/linux_misc.c      Sat Sep 11 20:53:04 2010 +0000
@@ -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 */
diff -r af96255ac34b -r afd6ffe53944 sys/compat/linux32/common/linux32_dirent.c
--- a/sys/compat/linux32/common/linux32_dirent.c        Sat Sep 11 20:49:28 2010 +0000
+++ b/sys/compat/linux32/common/linux32_dirent.c        Sat Sep 11 20:53:04 2010 +0000
@@ -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 */
diff -r af96255ac34b -r afd6ffe53944 sys/compat/linux32/common/linux32_types.h
--- a/sys/compat/linux32/common/linux32_types.h Sat Sep 11 20:49:28 2010 +0000
+++ b/sys/compat/linux32/common/linux32_types.h Sat Sep 11 20:53:04 2010 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index