netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
include/atalk/directory.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
3 * All Rights Reserved.
4 *
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.
14 *
15 * Research Systems Unix Group
16 * The University of Michigan
17 * c/o Mike Clark
18 * 535 W. William Street
19 * Ann Arbor, Michigan
20 * +1-313-763-0525
22 */
23
24#ifndef ATALK_DIRECTORY_H
25#define ATALK_DIRECTORY_H 1
26
27#include <arpa/inet.h>
28#include <dirent.h>
29#include <stdint.h>
30#include <sys/types.h>
31
32#include <bstrlib.h>
33
34#include <atalk/cnid.h>
35#include <atalk/queue.h>
36#include <atalk/unicode.h>
37
38/* setgid directories */
39#ifndef DIRBITS
40# define DIRBITS S_ISGID
41#endif /* DIRBITS */
42
43/* reserved directory id's */
44/* parent directory of root */
45#define DIRDID_ROOT_PARENT htonl(1)
46/* root directory */
47#define DIRDID_ROOT htonl(2)
48
49/* struct dir.d_flags */
50#define DIRF_FSMASK (3<<0)
51#define DIRF_NOFS (0<<0)
52#define DIRF_UFS (1<<1)
53/* it's cached file, not a directory */
54#define DIRF_ISFILE (1<<3)
55/* offsprings count is valid */
56#define DIRF_OFFCNT (1<<4)
57/* renumerate id */
58#define DIRF_CNID (1<<5)
59/* cache entry was returned without validation */
60#define DIRF_UNVALIDATED (1<<6)
61
62struct dir {
63 /* complete unix path to dir (or file) */
65 /* mac name */
67 /* unix name */
68 /* be careful here! if d_m_name == d_u_name, d_u_name */
69 /* will just point to the same storage as d_m_name !! */
71 /* mac name as UCS2 */
73 /* pointer to position in queue index */
75 /* inode ctime, used and modified by reenumeration */
76 time_t d_ctime;
77 /* directory flags */
79 /* CNID of parent directory */
81 /* CNID of directory */
83 /* offspring count */
84 uint32_t d_offcnt;
85 /* only needed in the dircache, because
86 we put all directories in one cache. */
87 uint16_t d_vid;
88 /* cached rights combinded from mode and possible ACL */
90 /* Stuff used in the dircache */
91 /* inode ctime, used and modified by dircache */
93 /* inode number, used to detect changes in the dircache */
95};
96
97struct path {
98 /* mac name type (long name, unicode */
99 int m_type;
100 /* mac name */
101 char *m_name;
102 /* unix name */
103 char *u_name;
104 /* file id (only for getmetadata) */
106 struct dir *d_dir;
107 /* does st_errno and st set */
110 struct stat st;
111};
112
113static inline int path_isadir(struct path *o_path)
114{
115 return o_path->d_dir != NULL;
116#if 0
117 return o_path->m_name == '\0' || /* we are in a it */
118 !o_path->st_valid || /* in cache but we can't chdir in it */
119 /* not in cache and can't chdir */
120 (!o_path->st_errno && S_ISDIR(o_path->st.st_mode));
121#endif
122}
123
124/* directory.c */
125extern struct dir rootParent;
126
127#endif /* ATALK_DIRECTORY_H */
uint32_t cnid_t
Definition adouble.h:156
C implementaion of bstring functions.
struct tagbstring * bstring
Definition bstrlib.h:82
struct dir rootParent
Definition directory.c:61
static int path_isadir(struct path *o_path)
Definition include/atalk/directory.h:113
struct qnode qnode_t
Definition include/atalk/directory.h:62
time_t d_ctime
Definition include/atalk/directory.h:76
uint16_t d_vid
Definition include/atalk/directory.h:87
time_t dcache_ctime
Definition include/atalk/directory.h:92
ino_t dcache_ino
Definition include/atalk/directory.h:94
cnid_t d_did
Definition include/atalk/directory.h:82
qnode_t * qidx_node
Definition include/atalk/directory.h:74
bstring d_fullpath
Definition include/atalk/directory.h:64
ucs2_t * d_m_name_ucs2
Definition include/atalk/directory.h:72
uint32_t d_rights_cache
Definition include/atalk/directory.h:89
int d_flags
Definition include/atalk/directory.h:78
uint32_t d_offcnt
Definition include/atalk/directory.h:84
bstring d_m_name
Definition include/atalk/directory.h:66
bstring d_u_name
Definition include/atalk/directory.h:70
cnid_t d_pdid
Definition include/atalk/directory.h:80
Definition include/atalk/directory.h:97
char * u_name
Definition include/atalk/directory.h:103
int st_valid
Definition include/atalk/directory.h:108
struct stat st
Definition include/atalk/directory.h:110
int m_type
Definition include/atalk/directory.h:99
int st_errno
Definition include/atalk/directory.h:109
cnid_t id
Definition include/atalk/directory.h:105
struct dir * d_dir
Definition include/atalk/directory.h:106
char * m_name
Definition include/atalk/directory.h:101
#define ucs2_t
Definition unicode.h:8