2 * $Id: directory.h,v 1.3 2010-01-10 10:58:25 franklahm Exp $
4 * Copyright (c) 1990,1991 Regents of The University of Michigan.
7 * Permission to use, copy, modify, and distribute this software and
8 * its documentation for any purpose and without fee is hereby granted,
9 * provided that the above copyright notice appears in all copies and
10 * that both that copyright notice and this permission notice appear
11 * in supporting documentation, and that the name of The University
12 * of Michigan not be used in advertising or publicity pertaining to
13 * distribution of the software without specific, written prior
14 * permission. This software is supplied as is without expressed or
15 * implied warranties of any kind.
17 * Research Systems Unix Group
18 * The University of Michigan
20 * 535 W. William Street
23 * netatalk@itd.umich.edu
26 #ifndef ATALK_DIRECTORY_H
27 #define ATALK_DIRECTORY_H 1
29 #include <sys/cdefs.h>
30 #include <sys/types.h>
31 #include <netatalk/endian.h>
34 #include <atalk/cnid.h>
35 #include <atalk/directory.h>
37 /* setgid directories */
42 # define DIRBITS S_ISGID
46 /* the did tree is now a red-black tree while the parent/child
47 * tree is a circular doubly-linked list. how exciting. */
49 struct dir *d_left, *d_right, *d_back; /* for red-black tree */
51 struct dir *d_parent, *d_child; /* parent-child */
52 struct dir *d_prev, *d_next; /* siblings */
53 void *d_ofork; /* oforks using this directory. */
57 time_t ctime; /* inode ctime */
58 u_int32_t offcnt; /* offspring count */
60 char *d_m_name; /* mac name */
61 char *d_u_name; /* unix name */
62 ucs2_t *d_m_name_ucs2; /* mac name as UCS2 */
66 int m_type; /* mac name type (long name, unicode */
67 char *m_name; /* mac name */
68 char *u_name; /* unix name */
69 cnid_t id; /* file id (only for getmetadata) */
70 struct dir *d_dir; /* */
71 int st_valid; /* does st_errno and st set */
76 static inline int path_isadir(struct path *o_path)
78 return o_path->d_dir != NULL;
80 return o_path->m_name == '\0' || /* we are in a it */
81 !o_path->st_valid || /* in cache but we can't chdir in it */
82 (!o_path->st_errno && S_ISDIR(o_path->st.st_mode)); /* not in cache an can't chdir */
87 #endif /* ATALK_DIRECTORY_H */