queue_count--;
if (curdir == dir
- || dir->d_ofork
|| (dir->d_flags & DIRF_CACHELOCK)) { /* 2 */
if ((dir->qidx_node = enqueue(index_queue, dir)) == NULL) {
dircache_dump();
fprintf(dump, "Configured maximum cache size: %u\n\n", dircache_maxsize);
fprintf(dump, "Primary CNID index:\n");
- fprintf(dump, " VID DID CNID STAT PATH\n");
+ fprintf(dump, " VID DID CNID STAT PATH\n");
fprintf(dump, "====================================================================\n");
hash_scan_begin(&hs, dircache);
i = 1;
while ((hn = hash_scan_next(&hs))) {
dir = hnode_get(hn);
- fprintf(dump, "%05u: %3u %6u %6u %s%s%s %s\n",
+ fprintf(dump, "%05u: %3u %6u %6u %s%s %s\n",
i++,
ntohs(dir->d_vid),
ntohl(dir->d_pdid),
ntohl(dir->d_did),
dir->d_fullpath ? "d" : "f",
(dir->d_flags & DIRF_CACHELOCK) ? "l" : "-",
- dir->d_ofork ? "o" : "-",
cfrombstr(dir->d_u_name));
}
fprintf(dump, "\nSecondary DID/name index:\n");
- fprintf(dump, " VID DID CNID STAT PATH\n");
+ fprintf(dump, " VID DID CNID STAT PATH\n");
fprintf(dump, "====================================================================\n");
hash_scan_begin(&hs, index_didname);
i = 1;
while ((hn = hash_scan_next(&hs))) {
dir = hnode_get(hn);
- fprintf(dump, "%05u: %3u %6u %6u %s%s%s %s\n",
+ fprintf(dump, "%05u: %3u %6u %6u %s%s %s\n",
i++,
ntohs(dir->d_vid),
ntohl(dir->d_pdid),
ntohl(dir->d_did),
dir->d_fullpath ? "d" : "f",
(dir->d_flags & DIRF_CACHELOCK) ? "l" : "-",
- dir->d_ofork ? "o" : "-",
cfrombstr(dir->d_u_name));
}
fprintf(dump, "\nLRU Queue:\n");
- fprintf(dump, " VID DID CNID STAT PATH\n");
+ fprintf(dump, " VID DID CNID STAT PATH\n");
fprintf(dump, "====================================================================\n");
for (i = 1; i <= queue_count; i++) {
if (n == index_queue)
break;
dir = (struct dir *)n->data;
- fprintf(dump, "%05u: %3u %6u %6u %s%s%s %s\n",
+ fprintf(dump, "%05u: %3u %6u %6u %s%s %s\n",
i,
ntohs(dir->d_vid),
ntohl(dir->d_pdid),
ntohl(dir->d_did),
dir->d_fullpath ? "d" : "f",
(dir->d_flags & DIRF_CACHELOCK) ? "l" : "-",
- dir->d_ofork ? "o" : "-",
cfrombstr(dir->d_u_name));
n = n->next;
}
/* As long as directory.c hasn't got its own init call, this get initialized in dircache_init */
struct dir rootParent = {
NULL, NULL, NULL, NULL, /* path, d_m_name, d_u_name, d_m_name_ucs2 */
- NULL, NULL, 0, 0, /* qidx_node, d_ofork, ctime, d_flags */
+ NULL, 0, 0, /* qidx_node, ctime, d_flags */
0, 0, 0, 0 /* pdid, did, offcnt, d_vid */
};
struct dir *curdir = &rootParent;
if (dir->d_did == DIRDID_ROOT_PARENT || dir->d_did == DIRDID_ROOT)
return 0;
- if (dir->d_flags & DIRF_CACHELOCK || dir->d_ofork) { /* 1 */
- LOG(log_warning, logtype_afpd, "dir_remove(did:%u,'%s'): dir is locked or has opened forks",
+ if (dir->d_flags & DIRF_CACHELOCK) { /* 1 */
+ LOG(log_warning, logtype_afpd, "dir_remove(did:%u,'%s'): dir is locked",
ntohl(dir->d_did), cfrombstr(dir->d_u_name));
return 0;
}
}
vol = ofork->of_vol;
- dir = ofork->of_dir;
+ dir = dirlookup(vol, ofork->of_did);
if (NULL == (path.u_name = mtoupath(vol, of_name(ofork), dir->d_did, utf8_encoding()))) {
return( AFPERR_MISC );
/*
- * $Id: fork.h,v 1.18 2010-03-12 15:16:49 franklahm Exp $
- *
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
#include "directory.h"
struct file_key {
- dev_t dev;
- ino_t inode;
+ dev_t dev;
+ ino_t inode;
};
struct ofork {
struct file_key key;
- struct adouble *of_ad;
+ struct adouble *of_ad;
struct vol *of_vol;
- struct dir *of_dir;
-
- u_int16_t of_refnum;
+ cnid_t of_did;
+ uint16_t of_refnum;
int of_flags;
-
struct ofork **prevp, *next;
- struct ofork *of_d_prev, *of_d_next;
+// struct ofork *of_d_prev, *of_d_next;
};
-#define OPENFORK_DATA (0)
-#define OPENFORK_RSCS (1<<7)
+#define OPENFORK_DATA (0)
+#define OPENFORK_RSCS (1<<7)
-#define OPENACC_RD (1<<0)
-#define OPENACC_WR (1<<1)
-#define OPENACC_DRD (1<<4)
-#define OPENACC_DWR (1<<5)
+#define OPENACC_RD (1<<0)
+#define OPENACC_WR (1<<1)
+#define OPENACC_DRD (1<<4)
+#define OPENACC_DWR (1<<5)
/* ofork.of_flags bits */
-#define AFPFORK_OPEN (1<<0)
-#define AFPFORK_RSRC (1<<1)
-#define AFPFORK_DATA (1<<2)
+#define AFPFORK_OPEN (1<<0)
+#define AFPFORK_RSRC (1<<1)
+#define AFPFORK_DATA (1<<2)
#define AFPFORK_DIRTY (1<<3)
#define AFPFORK_ACCRD (1<<4)
#define AFPFORK_ACCWR (1<<5)
struct dir *olddir, const char *oldpath _U_,
struct dir *newdir, const char *newpath)
{
- struct ofork *of, *next, *d_ofork;
+ struct ofork *of, *next;
int done = 0;
if (!s_of)
while ((of = next)) {
next = next->next; /* so we can unhash and still be all right. */
- if (vol == of->of_vol && olddir == of->of_dir &&
- s_of->key.dev == of->key.dev &&
- s_of->key.inode == of->key.inode ) {
+ if (vol == of->of_vol
+ && olddir->d_did == of->of_did
+ && s_of->key.dev == of->key.dev
+ && s_of->key.inode == of->key.inode ) {
if (!done) {
strlcpy( of_name(of), newpath, of->of_ad->ad_m_namelen);
done = 1;
}
- if (newdir != olddir) {
- of->of_d_prev->of_d_next = of->of_d_next;
- of->of_d_next->of_d_prev = of->of_d_prev;
- if (of->of_dir->d_ofork == of) {
- of->of_dir->d_ofork = (of == of->of_d_next) ? NULL : of->of_d_next;
- }
- of->of_dir = newdir;
- if (!(d_ofork = newdir->d_ofork)) {
- newdir->d_ofork = of;
- of->of_d_next = of->of_d_prev = of;
- } else {
- of->of_d_next = d_ofork;
- of->of_d_prev = d_ofork->of_d_prev;
- of->of_d_prev->of_d_next = of;
- d_ofork->of_d_prev = of;
- }
- }
+ if (newdir != olddir)
+ of->of_did = newdir->d_did;
}
}
struct adouble *ad,
struct stat *st)
{
- struct ofork *of, *d_ofork;
+ struct ofork *of;
u_int16_t refnum, of_refnum;
int i;
of->of_ad = ad;
of->of_vol = vol;
- of->of_dir = dir;
-
- if (!(d_ofork = dir->d_ofork)) {
- dir->d_ofork = of;
- of->of_d_next = of->of_d_prev = of;
- } else {
- of->of_d_next = d_ofork;
- of->of_d_prev = d_ofork->of_d_prev;
- d_ofork->of_d_prev->of_d_next = of;
- d_ofork->of_d_prev = of;
- }
+ of->of_did = dir->d_did;
*ofrefnum = refnum;
of->of_refnum = refnum;
return;
of_unhash(of);
-
- /* detach ofork */
- of->of_d_prev->of_d_next = of->of_d_next;
- of->of_d_next->of_d_prev = of->of_d_prev;
- if (of->of_dir->d_ofork == of) {
- of->of_dir->d_ofork = (of == of->of_d_next) ? NULL : of->of_d_next;
- }
-
oforks[ of->of_refnum % nforks ] = NULL;
/* decrease refcount */
/*
- * $Id: directory.h,v 1.3.2.1 2010-02-01 10:56:08 franklahm Exp $
- *
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
*
/* will just point to the same storage as d_m_name !! */
ucs2_t *d_m_name_ucs2; /* mac name as UCS2 */
qnode_t *qidx_node; /* pointer to position in queue index */
- void *d_ofork; /* oforks using this directory. */
time_t ctime; /* inode ctime, used and modified by reenumeration */
time_t ctime_dircache; /* inode ctime, used and modified by dircache */
int d_flags; /* directory flags */