} /* resolve_dir */
/* Looks up for an opened adouble structure, opens resource fork of selected file. */
-static struct adouble *adl_lkup(struct vol *vol, char *upath, int cidx, int isdir)
+static struct adouble *adl_lkup(char *upath, struct stat *sb)
{
static struct adouble ad;
struct adouble *adp;
- char *mpath = utompath(vol, upath);
struct ofork *of;
+ int isdir = S_ISDIR(sb->st_mode);
-/*
- //if (dstack[cidx].dir == NULL && !resolve_dir(vol, cidx))
- // return NULL;
-
- //if ((of = of_findname(vol, dstack[cidx].dir, mpath))) {
- // adp = of->of_ad;
- //} else {
- */
+ if (!isdir && (of = of_findname(upath, sb ))) {
+ adp = of->of_ad;
+ } else {
memset(&ad, 0, sizeof(ad));
adp = &ad;
- /* } */
+ }
if ( ad_open( upath, ADFLAGS_HF | (isdir)?ADFLAGS_DIR:0, O_RDONLY, 0, adp) < 0 ) {
return NULL;
/* Check for creation date... */
if (c1.rbitmap & (1<<DIRPBIT_CDATE)) {
- if (adp || (adp = adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp = adl_lkup(uname, &sbuf))) {
if (ad_getdate(adp, AD_DATE_CREATE, (u_int32_t*)&c_date) >= 0)
c_date = AD_DATE_TO_UNIX(c_date);
else c_date = sbuf.st_mtime;
/* Check for backup date... */
if (c1.rbitmap & (1<<DIRPBIT_BDATE)) {
- if (adp || (adp == adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp == adl_lkup(uname, &sbuf))) {
if (ad_getdate(adp, AD_DATE_BACKUP, (u_int32_t*)&b_date) >= 0)
b_date = AD_DATE_TO_UNIX(b_date);
else b_date = sbuf.st_mtime;
/* Check attributes */
if ((c1.rbitmap & (1<<DIRPBIT_ATTR)) && c2.attr != 0)
- if (adp || (adp = adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp = adl_lkup(uname, &sbuf))) {
ad_getattr(adp, &attr);
if ((attr & c2.attr) != c1.attr)
goto crit_check_ret;
/* Check file type ID */
if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.f_type != 0)
- if (adp || (adp = adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp = adl_lkup(uname, &sbuf))) {
finfo = (struct finderinfo*)ad_entry(adp, ADEID_FINDERI);
if (finfo->f_type != c1.finfo.f_type)
goto crit_check_ret;
/* Check creator ID */
if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.creator != 0)
- if (adp || (adp = adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp = adl_lkup(uname, &sbuf))) {
finfo = (struct finderinfo*)ad_entry(adp, ADEID_FINDERI);
if (finfo->creator != c1.finfo.creator)
goto crit_check_ret;
/* Check finder info attributes */
if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.attrs != 0)
- if (adp || (adp = adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp = adl_lkup(uname, &sbuf))) {
finfo = (struct finderinfo*)ad_entry(adp, ADEID_FINDERI);
if ((finfo->attrs & c2.finfo.attrs) != c1.finfo.attrs)
goto crit_check_ret;
/* Check label */
if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.label != 0)
- if (adp || (adp = adl_lkup(vol, uname, cidx, r))) {
+ if (adp || (adp = adl_lkup(uname, &sbuf))) {
finfo = (struct finderinfo*)ad_entry(adp, ADEID_FINDERI);
if ((finfo->label & c2.finfo.label) != c1.finfo.label)
goto crit_check_ret;
/*
- * $Id: desktop.c,v 1.14 2002-09-04 17:28:08 didg Exp $
+ * $Id: desktop.c,v 1.15 2002-09-05 14:52:05 didg Exp $
*
* See COPYRIGHT.
*/
clen = (u_char)*ibuf++;
clen = min( clen, 199 );
upath = mtoupath( vol, path );
- if ((*path == '\0') || !(of = of_findname(vol, curdir, upath, NULL))) {
+ if ((*path == '\0') || !(of = of_findname(upath, NULL))) {
memset(&ad, 0, sizeof(ad));
adp = &ad;
} else
upath = mtoupath( vol, path );
- if ((*path == '\0') || !(of = of_findname(vol, curdir, upath, NULL))) {
+ if ((*path == '\0') || !(of = of_findname(upath, NULL))) {
memset(&ad, 0, sizeof(ad));
adp = &ad;
} else
}
upath = mtoupath( vol, path );
- if ((*path == '\0') || !(of = of_findname(vol, curdir, upath, NULL))) {
+ if ((*path == '\0') || !(of = of_findname(upath, NULL))) {
memset(&ad, 0, sizeof(ad));
adp = &ad;
} else
/*
- * $Id: file.c,v 1.54 2002-09-04 17:28:08 didg Exp $
+ * $Id: file.c,v 1.55 2002-09-05 14:52:05 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#endif /* DEBUG */
upath = mtoupath(vol, path);
- if ((of = of_findname(vol, dir, upath, st))) {
+ if ((of = of_findname(upath, st))) {
adp = of->of_ad;
attrbits = ((of->of_ad->ad_df.adf_refcount > 0) ? ATTRBIT_DOPEN : 0);
attrbits |= ((of->of_ad->ad_hf.adf_refcount > of->of_ad->ad_df.adf_refcount)? ATTRBIT_ROPEN : 0);
ret = stat(upath, &st);
/* if upath is deleted we already in trouble anyway */
- if (!ret && (of = of_findname(vol, curdir, upath, &st))) {
+ if (!ret && (of = of_findname(upath, &st))) {
adp = of->of_ad;
} else {
memset(&ad, 0, sizeof(ad));
#endif /* DEBUG */
upath = mtoupath(vol, path);
- if ((of = of_findname(vol, curdir, upath, NULL))) {
+ if ((of = of_findname(upath, NULL))) {
adp = of->of_ad;
} else {
memset(&ad, 0, sizeof(ad));
* we just balk if the file is opened already. */
upath = mtoupath(vol, newname );
- if (of_findname(vol, curdir, upath, NULL))
+ if (of_findname(upath, NULL))
return AFPERR_DENYCONF;
newname = obj->newtmp;
}
memset(&ads, 0, sizeof(ads));
adsp = &ads;
- if ((s_of = of_findname(vol, curdir, upath, &srcst))) {
+ if ((s_of = of_findname(upath, &srcst))) {
/* reuse struct adouble so it won't break locks */
adsp = s_of->of_ad;
}
}
memset(&add, 0, sizeof(add));
addp = &add;
- if ((d_of = of_findname(vol, curdir, upath, &destst))) {
+ if ((d_of = of_findname( upath, &destst))) {
/* reuse struct adouble so it won't break locks */
addp = d_of->of_ad;
}
/*
- * $Id: filedir.c,v 1.29 2002-09-04 17:28:08 didg Exp $
+ * $Id: filedir.c,v 1.30 2002-09-05 14:52:06 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
id = cnid_get(vol->v_db, sdir->d_did, p, strlen(p));
#endif /* CNID_DB */
p = ctoupath( vol, sdir, oldname );
- if ((opened = of_findname(vol, sdir, p, NULL))) {
+ if ((opened = of_findname(p, NULL))) {
/* reuse struct adouble so it won't break locks */
adp = opened->of_ad;
}
return AFPERR_EXIST;
if ( !isdir ) {
- if (of_findname(vol, curdir, upath, &st)) {
+ if (of_findname(upath, &st)) {
rc = AFPERR_EXIST; /* was AFPERR_BUSY; */
} else {
rc = renamefile( p, upath, newname,vol_noadouble(vol), adp );
upath = mtoupath(vol, path );
if ( *path == '\0' ) {
rc = deletecurdir( vol, obj->oldtmp, AFPOBJ_TMPSIZ);
- } else if (of_findname(vol, curdir, upath, NULL)) {
+ } else if (of_findname(upath, NULL)) {
rc = AFPERR_BUSY;
} else if ((rc = deletefile( upath, 1)) == AFP_OK) {
#ifdef CNID_DB /* get rid of entry */
/*
- * $Id: fork.c,v 1.35 2002-09-04 17:28:08 didg Exp $
+ * $Id: fork.c,v 1.36 2002-09-05 14:52:06 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
ad_open so that we can keep file locks together.
FIXME: add the fork we are opening?
*/
- if ((opened = of_findname(vol, curdir, upath, &st))) {
+ if ((opened = of_findname(upath, &st))) {
attrbits = ((opened->of_ad->ad_df.adf_refcount > 0) ? ATTRBIT_DOPEN : 0);
attrbits |= ((opened->of_ad->ad_hf.adf_refcount > opened->of_ad->ad_df.adf_refcount)? ATTRBIT_ROPEN : 0);
/*
- * $Id: fork.h,v 1.4 2002-09-04 17:28:08 didg Exp $
+ * $Id: fork.h,v 1.5 2002-09-05 14:52:07 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
struct stat *));
extern void of_dealloc __P((struct ofork *));
extern struct ofork *of_find __P((const u_int16_t));
-extern struct ofork *of_findname __P((const struct vol *, const struct dir *,
- const char *,
- struct stat *));
+extern struct ofork *of_findname __P((const char *, struct stat *));
extern int of_rename __P((const struct vol *,
struct ofork *,
struct dir *, const char *,
/*
- * $Id: ofork.c,v 1.17 2002-09-04 17:28:08 didg Exp $
+ * $Id: ofork.c,v 1.18 2002-09-05 14:52:07 didg Exp $
*
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
/* --------------------------
*/
struct ofork *
- of_findname(const struct vol *vol, const struct dir *dir, const char *name,
- struct stat *st)
+ of_findname(const char *name, struct stat *st)
{
struct ofork *of;
struct file_key key;
key.inode = st->st_ino;
for (of = ofork_table[hashfn(&key)]; of; of = of->next) {
- if (vol == of->of_vol && dir == of->of_dir &&
- key.dev == of->key.dev && key.inode == of->key.inode ) {
+ if (key.dev == of->key.dev && key.inode == of->key.inode ) {
return of;
}
}