summaryrefslogtreecommitdiff
path: root/gcc/config/winnt/dirent.h
blob: 822bd2cab06d04ea7614cbf7b00aa11006b7cc59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * dirent.h
 */

#ifndef _DIRENT_H
#  define _DIRENT_H

#  include <sys/types.h>
#  include <limits.h>

#define MAXNAMLEN	255	/* maximum filename length		*/

#ifndef NAME_MAX
#define	NAME_MAX	(MAXNAMLEN - 1)
#endif

struct dirent			/* data from getdents()/readdir()	*/
{
    ino_t	d_ino;		/* inode number of entry		*/
    off_t	d_off;		/* offset of disk directory entry	*/
    wchar_t	d_reclen;	/* length of this record		*/
    char	d_name[MAXNAMLEN + 1];
};


/* The following nonportable ugliness could have been avoided by defining
 * DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
 * There shouldn't be any problem if you avoid using the DIRENTSIZ() macro.
 */

#define	DIRENTBASESIZ		(((struct dirent *)0)->d_name \
				- (char *)&((struct dirent *)0)->d_ino)

#define	DIRENTSIZ(namlen)	((DIRENTBASESIZ + sizeof(long) + (namlen)) \
				/ sizeof(long) * sizeof(long))



#  ifndef _BOOL_T_DEFINED
typedef unsigned char	bool;
#  define _BOOL_T_DEFINED
#  endif

#  define DIRBUF	8192	/* buffer size for fs-indep. dirs	*/
				/* must in general be larger than the	*/
				/* filesystem buffer size		*/

struct _dircontents {
    char		*_d_entry;
    struct _dircontents	*_d_next;
};

typedef struct _dirdesc {
    int			dd_id;	/* uniquely identify each open directory */
    long		dd_loc;	/* where we are in directory entry is this */
    struct _dircontents	*dd_contents;	/* pointer to contents of dir	*/
    struct _dircontents	*dd_cp;		/* pointer to current position	*/
} DIR;


#if defined (__STDC__)
#  define _PROTO(p)	p
#else
#  define _PROTO(p)	()
#  undef  const
#  undef  volatile
#endif

/* Functions */

extern DIR *		opendir	_PROTO ((const char *));
extern struct dirent * 	readdir _PROTO ((DIR *));
extern void		rewinddir _PROTO ((DIR *));

extern int		closedir _PROTO ((DIR *));
extern void		seekdir	_PROTO ((DIR *, off_t));
extern off_t		telldir	_PROTO ((DIR *));

extern int		chdir _PROTO ((const char *));
extern char * 		getcwd _PROTO ((char *, size_t));

extern int		mkdir _PROTO ((const char *));

extern int		rmdir _PROTO ((const char *));
extern int		scandir _PROTO ((char *,
			 struct dirent ***,
			 int (*)(const void *, const void *),
			 int (*)(const void *, const void *)));

extern int		_chdrive _PROTO ((int));
extern int		_getdrive _PROTO ((void));
extern char * 		_getdcwd _PROTO ((int, char *, int));

extern bool		IsHPFSFileSystem _PROTO ((char *));

#endif