From: didg Date: Thu, 5 Sep 2002 14:52:05 +0000 (+0000) Subject: of_findname: remove vol and dir X-Git-Tag: point-did-cleanup~27 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=761f679631e6f65712e1a21d05070f184ac06bec of_findname: remove vol and dir --- diff --git a/etc/afpd/catsearch.c b/etc/afpd/catsearch.c index d8cf010f..c292c040 100644 --- a/etc/afpd/catsearch.c +++ b/etc/afpd/catsearch.c @@ -233,24 +233,19 @@ static int resolve_dir(struct vol *vol, int cidx) } /* 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; @@ -316,7 +311,7 @@ static int crit_check(struct vol *vol, char *uname, char *fname, int cidx) { /* Check for creation date... */ if (c1.rbitmap & (1<= 0) c_date = AD_DATE_TO_UNIX(c_date); else c_date = sbuf.st_mtime; @@ -327,7 +322,7 @@ static int crit_check(struct vol *vol, char *uname, char *fname, int cidx) { /* Check for backup date... */ if (c1.rbitmap & (1<= 0) b_date = AD_DATE_TO_UNIX(b_date); else b_date = sbuf.st_mtime; @@ -338,7 +333,7 @@ static int crit_check(struct vol *vol, char *uname, char *fname, int cidx) { /* Check attributes */ if ((c1.rbitmap & (1<f_type != c1.finfo.f_type) goto crit_check_ret; @@ -355,7 +350,7 @@ static int crit_check(struct vol *vol, char *uname, char *fname, int cidx) { /* Check creator ID */ if ((c1.rbitmap & (1<creator != c1.finfo.creator) goto crit_check_ret; @@ -363,7 +358,7 @@ static int crit_check(struct vol *vol, char *uname, char *fname, int cidx) { /* Check finder info attributes */ if ((c1.rbitmap & (1<attrs & c2.finfo.attrs) != c1.finfo.attrs) goto crit_check_ret; @@ -371,7 +366,7 @@ static int crit_check(struct vol *vol, char *uname, char *fname, int cidx) { /* Check label */ if ((c1.rbitmap & (1<label & c2.finfo.label) != c1.finfo.label) goto crit_check_ret; diff --git a/etc/afpd/desktop.c b/etc/afpd/desktop.c index e3f138b7..43672599 100644 --- a/etc/afpd/desktop.c +++ b/etc/afpd/desktop.c @@ -1,5 +1,5 @@ /* - * $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. */ @@ -748,7 +748,7 @@ int ibuflen, *rbuflen; 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 @@ -811,7 +811,7 @@ int ibuflen, *rbuflen; 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 @@ -872,7 +872,7 @@ int ibuflen, *rbuflen; } 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 diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 85ab9e9a..dcbc9b10 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1,5 +1,5 @@ /* - * $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. @@ -374,7 +374,7 @@ int getfilparams(struct vol *vol, #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); @@ -464,7 +464,7 @@ int ibuflen, *rbuflen; 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)); @@ -614,7 +614,7 @@ int setfilparams(struct vol *vol, #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)); @@ -934,7 +934,7 @@ int ibuflen, *rbuflen; * 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; @@ -1701,7 +1701,7 @@ int ibuflen, *rbuflen; } 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; } @@ -1751,7 +1751,7 @@ int ibuflen, *rbuflen; } 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; } diff --git a/etc/afpd/filedir.c b/etc/afpd/filedir.c index f8a61f5d..155c7e6d 100644 --- a/etc/afpd/filedir.c +++ b/etc/afpd/filedir.c @@ -1,5 +1,5 @@ /* - * $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. @@ -384,7 +384,7 @@ int isdir; 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; } @@ -429,7 +429,7 @@ int isdir; 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 ); @@ -582,7 +582,7 @@ int ibuflen, *rbuflen; 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 */ diff --git a/etc/afpd/fork.c b/etc/afpd/fork.c index 28970c0a..2d744667 100644 --- a/etc/afpd/fork.c +++ b/etc/afpd/fork.c @@ -1,5 +1,5 @@ /* - * $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. @@ -303,7 +303,7 @@ int ibuflen, *rbuflen; 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); diff --git a/etc/afpd/fork.h b/etc/afpd/fork.h index d58389f4..d1bb770f 100644 --- a/etc/afpd/fork.h +++ b/etc/afpd/fork.h @@ -1,5 +1,5 @@ /* - * $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. @@ -59,9 +59,7 @@ extern struct ofork *of_alloc __P((struct vol *, struct dir *, 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 *, diff --git a/etc/afpd/ofork.c b/etc/afpd/ofork.c index bbc3aa77..b8717cd0 100644 --- a/etc/afpd/ofork.c +++ b/etc/afpd/ofork.c @@ -1,5 +1,5 @@ /* - * $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. @@ -273,8 +273,7 @@ struct ofork *of_find(const u_int16_t ofrefnum ) /* -------------------------- */ 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; @@ -290,8 +289,7 @@ struct ofork * 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; } }