svn commit: r225095 - in projects/ino64: include lib/libc/gen

Matthew D Fleming mdf at FreeBSD.org
Mon Aug 22 23:27:23 UTC 2011


Author: mdf
Date: Mon Aug 22 23:27:23 2011
New Revision: 225095
URL: http://svn.freebsd.org/changeset/base/225095

Log:
  Hide DIR definition by making it an opaque struct typedef.
  GSoC r222617, r222832.
  Code by Gleb Kurtsou.

Added:
  projects/ino64/lib/libc/gen/dirent-private.h   (contents, props changed)
Modified:
  projects/ino64/include/dirent.h
  projects/ino64/lib/libc/gen/closedir.c
  projects/ino64/lib/libc/gen/fts-compat.c
  projects/ino64/lib/libc/gen/fts.c
  projects/ino64/lib/libc/gen/getcwd.c
  projects/ino64/lib/libc/gen/opendir.c
  projects/ino64/lib/libc/gen/readdir.c
  projects/ino64/lib/libc/gen/rewinddir.c
  projects/ino64/lib/libc/gen/seekdir.c
  projects/ino64/lib/libc/gen/telldir.c

Modified: projects/ino64/include/dirent.h
==============================================================================
--- projects/ino64/include/dirent.h	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/include/dirent.h	Mon Aug 22 23:27:23 2011	(r225095)
@@ -55,24 +55,8 @@
 /* definitions for library routines operating on directories. */
 #define	DIRBLKSIZ	1024
 
-struct _telldir;		/* see telldir.h */
-struct pthread_mutex;
-
-/* structure describing an open directory. */
-typedef struct _dirdesc {
-	int	dd_fd;		/* file descriptor associated with directory */
-	long	dd_loc;		/* offset in current buffer */
-	long	dd_size;	/* amount of data returned by getdirentries */
-	char	*dd_buf;	/* data buffer */
-	int	dd_len;		/* size of data buffer */
-	long	dd_seek;	/* magic cookie returned by getdirentries */
-	long	dd_rewind;	/* magic cookie for rewinding */
-	int	dd_flags;	/* flags for readdir */
-	struct pthread_mutex	*dd_lock;	/* lock */
-	struct _telldir *dd_td;	/* telldir position recording */
-} DIR;
-
-#define	dirfd(dirp)	((dirp)->dd_fd)
+struct _dirdesc;
+typedef struct _dirdesc DIR;
 
 /* flags for opendir2 */
 #define DTF_HIDEW	0x0001	/* hide whiteout entries */

Modified: projects/ino64/lib/libc/gen/closedir.c
==============================================================================
--- projects/ino64/lib/libc/gen/closedir.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/closedir.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 #include "libc_private.h"
+#include "dirent-private.h"
 #include "telldir.h"
 
 /*

Added: projects/ino64/lib/libc/gen/dirent-private.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ino64/lib/libc/gen/dirent-private.h	Mon Aug 22 23:27:23 2011	(r225095)
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _DIRENT_PRIVATE_H_
+#define	_DIRENT_PRIVATE_H_
+
+struct _telldir;		/* see telldir.h */
+struct pthread_mutex;
+
+/* structure describing an open directory. */
+struct _dirdesc {
+	int	dd_fd;		/* file descriptor associated with directory */
+	long	dd_loc;		/* offset in current buffer */
+	long	dd_size;	/* amount of data returned by getdirentries */
+	char	*dd_buf;	/* data buffer */
+	int	dd_len;		/* size of data buffer */
+	long	dd_seek;	/* magic cookie returned by getdirentries */
+	long	dd_rewind;	/* magic cookie for rewinding */
+	int	dd_flags;	/* flags for readdir */
+	struct pthread_mutex	*dd_lock;	/* lock */
+	struct _telldir *dd_td;	/* telldir position recording */
+};
+
+#define	dirfd(dirp)	((dirp)->dd_fd)
+
+#endif /* !_DIRENT_PRIVATE_H_ */

Modified: projects/ino64/lib/libc/gen/fts-compat.c
==============================================================================
--- projects/ino64/lib/libc/gen/fts-compat.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/fts-compat.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
 #include "fts-compat.h"
 #include "un-namespace.h"
 
+#include "dirent-private.h"
+
 FTSENT	*__fts_children_44bsd(FTS *, int);
 int	 __fts_close_44bsd(FTS *);
 void	*__fts_get_clientptr_44bsd(FTS *);

Modified: projects/ino64/lib/libc/gen/fts.c
==============================================================================
--- projects/ino64/lib/libc/gen/fts.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/fts.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
 #include <unistd.h>
 #include "un-namespace.h"
 
+#include "dirent-private.h"
+
 static FTSENT	*fts_alloc(FTS *, char *, size_t);
 static FTSENT	*fts_build(FTS *, int);
 static void	 fts_lfree(FTSENT *);

Modified: projects/ino64/lib/libc/gen/getcwd.c
==============================================================================
--- projects/ino64/lib/libc/gen/getcwd.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/getcwd.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$");
 #include <unistd.h>
 #include "un-namespace.h"
 
+#include "dirent-private.h"
+
 #define	ISDOT(dp) \
 	(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
 	    (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))

Modified: projects/ino64/lib/libc/gen/opendir.c
==============================================================================
--- projects/ino64/lib/libc/gen/opendir.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/opendir.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <unistd.h>
 #include "un-namespace.h"
 
+#include "dirent-private.h"
 #include "telldir.h"
 
 static DIR * __opendir_common(int, const char *, int);

Modified: projects/ino64/lib/libc/gen/readdir.c
==============================================================================
--- projects/ino64/lib/libc/gen/readdir.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/readdir.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 #include "libc_private.h"
+#include "dirent-private.h"
 #include "telldir.h"
 
 /*

Modified: projects/ino64/lib/libc/gen/rewinddir.c
==============================================================================
--- projects/ino64/lib/libc/gen/rewinddir.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/rewinddir.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/types.h>
 #include <dirent.h>
 
+#include "dirent-private.h"
 #include "telldir.h"
 
 void

Modified: projects/ino64/lib/libc/gen/seekdir.c
==============================================================================
--- projects/ino64/lib/libc/gen/seekdir.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/seekdir.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 #include "libc_private.h"
+#include "dirent-private.h"
 #include "telldir.h"
 
 /*

Modified: projects/ino64/lib/libc/gen/telldir.c
==============================================================================
--- projects/ino64/lib/libc/gen/telldir.c	Mon Aug 22 23:20:13 2011	(r225094)
+++ projects/ino64/lib/libc/gen/telldir.c	Mon Aug 22 23:27:23 2011	(r225095)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 #include "libc_private.h"
+#include "dirent-private.h"
 #include "telldir.h"
 
 /*


More information about the svn-src-projects mailing list