2 * $Id: directory.h,v 1.3.2.1 2010-02-01 10:56:08 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>
35 #include <atalk/cnid.h>
36 #include <atalk/bstrlib.h>
37 #include <atalk/queue.h>
39 /* setgid directories */
44 # define DIRBITS S_ISGID
48 /* reserved directory id's */
49 #define DIRDID_ROOT_PARENT htonl(1) /* parent directory of root */
50 #define DIRDID_ROOT htonl(2) /* root directory */
53 bstring d_fullpath; /* complete unix path to dir */
54 bstring d_m_name; /* mac name */
55 bstring d_u_name; /* unix name */
56 /* be careful here! if d_m_name == d_u_name, d_u_name */
57 /* will just point to the same storage as d_m_name !! */
58 ucs2_t *d_m_name_ucs2; /* mac name as UCS2 */
59 qnode_t *qidx_node; /* pointer to position in queue index */
60 void *d_ofork; /* oforks using this directory. */
61 time_t ctime; /* inode ctime */
62 int d_flags; /* directory flags */
63 cnid_t d_pdid; /* CNID of parent directory */
64 cnid_t d_did; /* CNID of directory */
65 uint32_t offcnt; /* offspring count */
66 uint16_t d_vid; /* only needed in the dircache, because
67 we put all directories in one cache. */
71 int m_type; /* mac name type (long name, unicode */
72 char *m_name; /* mac name */
73 char *u_name; /* unix name */
74 cnid_t id; /* file id (only for getmetadata) */
75 struct dir *d_dir; /* */
76 int st_valid; /* does st_errno and st set */
81 static inline int path_isadir(struct path *o_path)
83 return o_path->d_dir != NULL;
85 return o_path->m_name == '\0' || /* we are in a it */
86 !o_path->st_valid || /* in cache but we can't chdir in it */
87 (!o_path->st_errno && S_ISDIR(o_path->st.st_mode)); /* not in cache an can't chdir */
91 #endif /* ATALK_DIRECTORY_H */