Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Introduce KERNEL_NAME_MAX = 255, and bump NAME_MAX t...
details: https://anonhg.NetBSD.org/src/rev/6e8dc3b957f8
branches: trunk
changeset: 769940:6e8dc3b957f8
user: christos <christos%NetBSD.org@localhost>
date: Tue Sep 27 01:40:32 2011 +0000
description:
Introduce KERNEL_NAME_MAX = 255, and bump NAME_MAX to 511. This makes
NAME_MAX match MAXNAMLEN, while at the same time does not allow names
to exceed KERNEL_NAME_MAX (enforced in vfs_lookup) so that binaries
don't break.
diffstat:
sys/sys/dirent.h | 4 ++--
sys/sys/extattr.h | 6 +++---
sys/sys/mqueue.h | 5 +++--
sys/sys/param.h | 11 ++++++++++-
sys/sys/syslimits.h | 5 +++--
sys/sys/xattr.h | 6 +++---
6 files changed, 24 insertions(+), 13 deletions(-)
diffs (137 lines):
diff -r 01f40673589c -r 6e8dc3b957f8 sys/sys/dirent.h
--- a/sys/sys/dirent.h Tue Sep 27 01:34:41 2011 +0000
+++ b/sys/sys/dirent.h Tue Sep 27 01:40:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dirent.h,v 1.27 2011/08/09 20:05:04 dholland Exp $ */
+/* $NetBSD: dirent.h,v 1.28 2011/09/27 01:40:32 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -52,7 +52,7 @@
uint16_t d_namlen; /* length of string in d_name */
uint8_t d_type; /* file type, see below */
#if defined(_NETBSD_SOURCE)
-#define MAXNAMLEN 511
+#define MAXNAMLEN 511 /* must be kept in sync with NAME_MAX */
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
#else
char d_name[511 + 1]; /* name must be no longer than this */
diff -r 01f40673589c -r 6e8dc3b957f8 sys/sys/extattr.h
--- a/sys/sys/extattr.h Tue Sep 27 01:34:41 2011 +0000
+++ b/sys/sys/extattr.h Tue Sep 27 01:40:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extattr.h,v 1.7 2011/08/03 04:11:17 manu Exp $ */
+/* $NetBSD: extattr.h,v 1.8 2011/09/27 01:40:32 christos Exp $ */
/*-
* Copyright (c) 1999-2001 Robert N. M. Watson
@@ -52,12 +52,12 @@
#ifdef _KERNEL
-#include <sys/syslimits.h>
+#include <sys/param.h>
/* VOP_LISTEXTATTR flags */
#define EXTATTR_LIST_LENPREFIX 1 /* names with length prefix */
-#define EXTATTR_MAXNAMELEN NAME_MAX
+#define EXTATTR_MAXNAMELEN KERNEL_NAME_MAX
struct lwp;
struct vnode;
int extattr_check_cred(struct vnode *, int, kauth_cred_t,
diff -r 01f40673589c -r 6e8dc3b957f8 sys/sys/mqueue.h
--- a/sys/sys/mqueue.h Tue Sep 27 01:34:41 2011 +0000
+++ b/sys/sys/mqueue.h Tue Sep 27 01:40:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mqueue.h,v 1.13 2011/04/24 20:17:53 rmind Exp $ */
+/* $NetBSD: mqueue.h,v 1.14 2011/09/27 01:40:32 christos Exp $ */
/*
* Copyright (c) 2007-2009 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -50,6 +50,7 @@
#include <sys/queue.h>
#include <sys/selinfo.h>
#include <sys/types.h>
+#include <sys/param.h>
/*
* Flags below are used in mq_flags for internal purposes.
@@ -62,7 +63,7 @@
#define MQ_RECEIVE 0x20000000
/* Maximal length of mqueue name */
-#define MQ_NAMELEN (NAME_MAX + 1)
+#define MQ_NAMELEN (KERNEL_NAME_MAX + 1)
/* Default size of the message */
#define MQ_DEF_MSGSIZE 1024
diff -r 01f40673589c -r 6e8dc3b957f8 sys/sys/param.h
--- a/sys/sys/param.h Tue Sep 27 01:34:41 2011 +0000
+++ b/sys/sys/param.h Tue Sep 27 01:40:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.393 2011/09/23 14:47:41 christos Exp $ */
+/* $NetBSD: param.h,v 1.394 2011/09/27 01:40:32 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -323,6 +323,15 @@
#define MAXPATHLEN PATH_MAX
#define MAXSYMLINKS 32
+/*
+ * This is the maximum individual filename component length enforced by
+ * namei. Filesystems cannot exceed this limit. The upper bound for that
+ * limit is NAME_MAX. We don't bump it for now, for compatibility with
+ * old binaries during the time where MAXPATHLEN was 511 and NAME_MAX was
+ * 255
+ */
+#define KERNEL_NAME_MAX 255
+
/* Bit map related macros. */
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
diff -r 01f40673589c -r 6e8dc3b957f8 sys/sys/syslimits.h
--- a/sys/sys/syslimits.h Tue Sep 27 01:34:41 2011 +0000
+++ b/sys/sys/syslimits.h Tue Sep 27 01:40:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syslimits.h,v 1.24 2008/02/25 17:29:13 ad Exp $ */
+/* $NetBSD: syslimits.h,v 1.25 2011/09/27 01:40:32 christos Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -46,7 +46,8 @@
#define LINK_MAX 32767 /* max file link count */
#define MAX_CANON 255 /* max bytes in term canon input line */
#define MAX_INPUT 255 /* max bytes in terminal input */
-#define NAME_MAX 255 /* max bytes in a file name */
+#define NAME_MAX 511 /* max bytes in a file name, must be
+ /* kept in sync with MAXPATHLEN */
#define NGROUPS_MAX 16 /* max supplemental group id's */
#define UID_MAX 2147483647U /* max value for a uid_t (2^31-2) */
#ifndef OPEN_MAX
diff -r 01f40673589c -r 6e8dc3b957f8 sys/sys/xattr.h
--- a/sys/sys/xattr.h Tue Sep 27 01:34:41 2011 +0000
+++ b/sys/sys/xattr.h Tue Sep 27 01:40:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xattr.h,v 1.4 2011/07/18 11:28:24 drochner Exp $ */
+/* $NetBSD: xattr.h,v 1.5 2011/09/27 01:40:32 christos Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -41,13 +41,13 @@
#define _SYS_XATTR_H_
#include <sys/types.h>
-#include <sys/syslimits.h>
+#include <sys/param.h>
/*
* This is compatible with EXTATTR_MAXNAMELEN, and also happens to be
* the same as Linux (255).
*/
-#define XATTR_NAME_MAX NAME_MAX
+#define XATTR_NAME_MAX KERNEL_NAME_MAX
#define XATTR_SIZE_MAX 65536 /* NetBSD does not enforce this */
Home |
Main Index |
Thread Index |
Old Index