2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
5 * Permission to use, copy, modify, and distribute this software and
6 * its documentation for any purpose and without fee is hereby granted,
7 * provided that the above copyright notice appears in all copies and
8 * that both that copyright notice and this permission notice appear
9 * in supporting documentation, and that the name of The University
10 * of Michigan not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. This software is supplied as is without expressed or
13 * implied warranties of any kind.
15 * Research Systems Unix Group
16 * The University of Michigan
18 * 535 W. William Street
21 * netatalk@itd.umich.edu
24 #ifndef ATALK_DIRECTORY_H
25 #define ATALK_DIRECTORY_H 1
27 #include <sys/cdefs.h>
28 #include <sys/types.h>
29 #include <netatalk/endian.h>
33 #include <atalk/cnid.h>
34 #include <atalk/bstrlib.h>
35 #include <atalk/queue.h>
37 /* setgid directories */
42 # define DIRBITS S_ISGID
46 /* reserved directory id's */
47 #define DIRDID_ROOT_PARENT htonl(1) /* parent directory of root */
48 #define DIRDID_ROOT htonl(2) /* root directory */
51 bstring d_fullpath; /* complete unix path to dir */
52 bstring d_m_name; /* mac name */
53 bstring d_u_name; /* unix name */
54 /* be careful here! if d_m_name == d_u_name, d_u_name */
55 /* will just point to the same storage as d_m_name !! */
56 ucs2_t *d_m_name_ucs2; /* mac name as UCS2 */
57 qnode_t *qidx_node; /* pointer to position in queue index */
58 time_t d_ctime; /* inode ctime, used and modified by reenumeration */
59 time_t ctime_dircache; /* inode ctime, used and modified by dircache */
60 int d_flags; /* directory flags */
61 cnid_t d_pdid; /* CNID of parent directory */
62 cnid_t d_did; /* CNID of directory */
63 uint32_t offcnt; /* offspring count */
64 uint16_t d_vid; /* only needed in the dircache, because
65 we put all directories in one cache. */
69 int m_type; /* mac name type (long name, unicode */
70 char *m_name; /* mac name */
71 char *u_name; /* unix name */
72 cnid_t id; /* file id (only for getmetadata) */
73 struct dir *d_dir; /* */
74 int st_valid; /* does st_errno and st set */
79 static inline int path_isadir(struct path *o_path)
81 return o_path->d_dir != NULL;
83 return o_path->m_name == '\0' || /* we are in a it */
84 !o_path->st_valid || /* in cache but we can't chdir in it */
85 (!o_path->st_errno && S_ISDIR(o_path->st.st_mode)); /* not in cache an can't chdir */
89 #endif /* ATALK_DIRECTORY_H */