~ubuntu-branches/ubuntu/utopic/cdrdao/utopic

« back to all changes in this revision

Viewing changes to scsilib/include/dirdefs.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Suffield
  • Date: 2004-06-24 22:33:16 UTC
  • Revision ID: james.westby@ubuntu.com-20040624223316-534onzugaeeyq61j
Tags: upstream-1.1.9
ImportĀ upstreamĀ versionĀ 1.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)dirdefs.h        1.14 03/06/15 Copyright 1987, 1998 J. Schilling */
 
2
/*
 
3
 *      Copyright (c) 1987, 1998 J. Schilling
 
4
 */
 
5
/*
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2, or (at your option)
 
9
 * any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License along with
 
17
 * this program; see the file COPYING.  If not, write to the Free Software
 
18
 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#ifndef _DIRDEFS_H
 
22
#define _DIRDEFS_H
 
23
 
 
24
#ifndef _MCONFIG_H
 
25
#include <mconfig.h>
 
26
#endif
 
27
 
 
28
#ifdef  __cplusplus
 
29
extern "C" {
 
30
#endif
 
31
 
 
32
#ifdef JOS
 
33
#       ifndef  _INCL_SYS_STYPES_H
 
34
#       include <sys/stypes.h>
 
35
#       define  _INCL_SYS_STYPES_H
 
36
#       endif
 
37
#       ifndef  _INCL_SYS_FILEDESC_H
 
38
#       include <sys/filedesc.h>
 
39
#       define  _INCL_SYS_FILEDESC_H
 
40
#       endif
 
41
#       define  NEED_READDIR
 
42
#       define  DIRSIZE 30
 
43
#       define  FOUND_DIRSIZE
 
44
        typedef struct dirent {
 
45
                char    name[DIRSIZE];
 
46
                short   ino;
 
47
        } dirent;
 
48
 
 
49
#else   /* !JOS */
 
50
 
 
51
#       ifndef  _INCL_SYS_TYPES_H
 
52
#       include <sys/types.h>
 
53
#       define  _INCL_SYS_TYPES_H
 
54
#       endif
 
55
#       ifndef  _INCL_SYS_STAT_H
 
56
#       include <sys/stat.h>
 
57
#       define  _INCL_SYS_STAT_H
 
58
#       endif
 
59
#       ifdef   HAVE_LIMITS_H
 
60
#               ifndef  _INCL_LIMITS_H
 
61
#               include <limits.h>
 
62
#               define  _INCL_LIMITS_H
 
63
#               endif
 
64
#       endif
 
65
#       ifdef   HAVE_SYS_PARAM_H
 
66
#               ifndef  _INCL_SYS_PARAM_H
 
67
#               include <sys/param.h>
 
68
#               define  _INCL_SYS_PARAM_H
 
69
#               endif
 
70
#       endif
 
71
 
 
72
#       ifdef   HAVE_DIRENT_H           /* This a POSIX compliant system */
 
73
#               ifndef  _INCL_DIRENT_H
 
74
#               include <dirent.h>
 
75
#               define  _INCL_DIRENT_H
 
76
#               endif
 
77
#               define  DIR_NAMELEN(dirent)     strlen((dirent)->d_name)
 
78
#               define  _FOUND_DIR_
 
79
#       else                            /* This is a Pre POSIX system    */
 
80
 
 
81
#       define  dirent  direct
 
82
#       define  DIR_NAMELEN(dirent)     (dirent)->d_namlen
 
83
 
 
84
#       if      defined(HAVE_SYS_DIR_H)
 
85
#               ifndef  _INCL_SYS_DIR_H
 
86
#               include <sys/dir.h>
 
87
#               define  _INCL_SYS_DIR_H
 
88
#               endif
 
89
#               define  _FOUND_DIR_
 
90
#       endif
 
91
 
 
92
#       if      defined(HAVE_NDIR_H) && !defined(_FOUND_DIR_)
 
93
#               ifndef  _INCL_NDIR_H
 
94
#               include <ndir.h>
 
95
#               define  _INCL_NDIR_H
 
96
#               endif
 
97
#               define  _FOUND_DIR_
 
98
#       endif
 
99
 
 
100
#       if      defined(HAVE_SYS_NDIR_H) && !defined(_FOUND_DIR_)
 
101
#               ifndef  _INCL_SYS_NDIR_H
 
102
#               include <sys/ndir.h>
 
103
#               define  _INCL_SYS_NDIR_H
 
104
#               endif
 
105
#               define  _FOUND_DIR_
 
106
#       endif
 
107
#       endif   /* HAVE_DIRENT_H */
 
108
 
 
109
#       if      defined(_FOUND_DIR_)
 
110
/*
 
111
 * Don't use defaults here to allow recognition of problems.
 
112
 */
 
113
#       ifdef   MAXNAMELEN
 
114
#               define  DIRSIZE         MAXNAMELEN      /* From sys/param.h */
 
115
#               define  FOUND_DIRSIZE
 
116
#       else
 
117
#       ifdef   MAXNAMLEN
 
118
#               define  DIRSIZE         MAXNAMLEN       /* From dirent.h    */
 
119
#               define  FOUND_DIRSIZE
 
120
#       else
 
121
#       ifdef   DIRSIZ
 
122
#               define  DIRSIZE         DIRSIZ          /* From sys/dir.h   */
 
123
#               define  FOUND_DIRSIZE
 
124
#       endif
 
125
#       endif
 
126
#       endif
 
127
#       else    /* !_FOUND_DIR_ */
 
128
 
 
129
#               define  NEED_DIRENT
 
130
#               define  NEED_READDIR
 
131
 
 
132
#       endif   /* _FOUND_DIR_ */
 
133
 
 
134
 
 
135
#ifdef  NEED_DIRENT
 
136
 
 
137
#ifndef FOUND_DIRSIZE
 
138
#define DIRSIZE         14      /* The old UNIX standard value */
 
139
#define FOUND_DIRSIZE
 
140
#endif
 
141
 
 
142
typedef struct dirent {
 
143
        short   ino;
 
144
        char    name[DIRSIZE];
 
145
} dirent;
 
146
 
 
147
#endif  /* NEED_DIRENT */
 
148
 
 
149
#endif  /* !JOS */
 
150
 
 
151
#ifdef  NEED_READDIR
 
152
        typedef struct __dirdesc {
 
153
                FILE    *dd_fd;
 
154
        } DIR;
 
155
 
 
156
        struct _direct {
 
157
                unsigned long   d_ino;
 
158
                unsigned short  d_reclen;
 
159
                unsigned short  d_namlen;
 
160
                char            d_name[DIRSIZE +1];
 
161
        };
 
162
 
 
163
extern  DIR             *opendir();
 
164
extern                  closedir();
 
165
extern  struct direct   *readdir();
 
166
 
 
167
#endif  /* NEED_READDIR */
 
168
 
 
169
#ifdef  __cplusplus
 
170
}
 
171
#endif
 
172
 
 
173
#endif  /* _DIRDEFS_H */