Lines Matching defs:state

104                             struct position_state *state);
117 static int catrec_update(const CatalogKey *ckp, CatalogRecord *crp, struct update_state *state);
829 * Note that we could have gotten into this state if we had invalid ranges
1482 struct update_state state;
1489 state.s_desc = descp;
1490 state.s_attr = attrp;
1491 state.s_datafork = dataforkp;
1492 state.s_rsrcfork = rsrcforkp;
1493 state.s_hfsmp = hfsmp;
1521 (IterateCallBackProcPtr)catrec_update, &state);
1550 catrec_update(const CatalogKey *ckp, CatalogRecord *crp, struct update_state *state)
1559 descp = state->s_desc;
1560 attrp = state->s_attr;
1561 hfsmp = state->s_hfsmp;
1594 if (state->s_rsrcfork) {
1595 forkp = state->s_rsrcfork;
1605 if (state->s_datafork) {
1606 forkp = state->s_datafork;
1617 /* Synchronize the lock state */
1759 if (state->s_rsrcfork) {
1760 forkp = state->s_rsrcfork;
1769 if (state->s_datafork) {
1770 forkp = state->s_datafork;
1786 /* Synchronize the lock state */
1945 update_siblinglinks_callback(__unused const CatalogKey *ckp, CatalogRecord *crp, struct linkupdate_state *state)
1956 if (state->prevlinkid != HFS_IGNORABLE_LINK) {
1957 file->hl_prevLinkID = state->prevlinkid;
1959 if (state->nextlinkid != HFS_IGNORABLE_LINK) {
1960 file->hl_nextLinkID = state->nextlinkid;
1976 struct linkupdate_state state;
1980 state.filelinkid = linkfileid;
1981 state.prevlinkid = prevlinkid;
1982 state.nextlinkid = nextlinkid;
1990 result = BTUpdateRecord(fcb, iterator, (IterateCallBackProcPtr)update_siblinglinks_callback, &state);
2498 struct readattr_state *state)
2500 struct cat_entrylist *list = state->list;
2501 struct hfsmount *hfsmp = state->hfsmp;
2508 parentcnid = state->stdhfs ? key->hfs.parentID : key->hfsPlus.parentID;
2515 if (parentcnid != state->dir_cnid) {
2516 state->error = ENOENT;
2521 state->error = ENOENT;
2545 if (state->stdhfs) {
2603 struct readattr_state state;
2617 state.hfsmp = hfsmp;
2618 state.list = ce_list;
2619 state.dir_cnid = parentcnid;
2620 state.stdhfs = std_hfs;
2621 state.error = 0;
2682 (IterateCallBackProcPtr)getentriesattr_callback, &state);
2684 if (state.error)
2685 result = state.error;
2782 struct packdirentry_state *state)
2806 hfsmp = state->cbs_hfsmp;
2810 if (state->cbs_parentID != curID) {
2832 if (state->cbs_flags & VNODE_READDIR_EXTENDED) {
2836 if (state->cbs_hasprevdirentry) {
2839 state->cbs_eof = true;
2840 state->cbs_result = ENOENT;
2844 state->cbs_eof = true;
2845 state->cbs_result = ENOENT;
2850 if (state->cbs_flags & VNODE_READDIR_EXTENDED) {
2851 entry = state->cbs_direntry;
2853 if (state->cbs_flags & VNODE_READDIR_NAMEMAX) {
2869 if ((state->cbs_flags & VNODE_READDIR_EXTENDED) && stop_after_pack) {
2979 if (state->cbs_flags & VNODE_READDIR_EXTENDED) {
2987 state->cbs_prevdirentry->d_seekoff = (state->cbs_index + 3) | ((u_int64_t)cnid << 32);
2988 uiosize = state->cbs_prevdirentry->d_reclen;
2989 uioaddr = (caddr_t) state->cbs_prevdirentry;
3002 if (ilinkref || state->cbs_previlinkref) {
3003 uiobase = uio_curriovbase(state->cbs_uio);
3006 if ((uiosize > (user_size_t)uio_resid(state->cbs_uio)) ||
3007 (ilinkref != 0 && state->cbs_nlinks == state->cbs_maxlinks)) {
3011 if (!(state->cbs_flags & VNODE_READDIR_EXTENDED) || state->cbs_hasprevdirentry) {
3012 state->cbs_result = uiomove(uioaddr, uiosize, state->cbs_uio);
3013 if (state->cbs_result == 0) {
3014 ++state->cbs_index;
3017 state->cbs_desc->cd_cnid = cnid;
3019 state->cbs_desc->cd_flags |= CD_ISDIR;
3021 state->cbs_desc->cd_flags &= ~CD_ISDIR;
3023 if (state->cbs_desc->cd_nameptr != NULL) {
3024 state->cbs_desc->cd_namelen = 0;
3027 state->cbs_desc->cd_encoding = xxxx;
3030 state->cbs_desc->cd_namelen = namelen;
3031 bcopy(nameptr, state->cbs_namebuf, namelen + 1);
3049 state->cbs_desc->cd_namelen = tmp_namelen;
3050 bcopy(new_nameptr, state->cbs_namebuf, tmp_namelen + 1);
3055 if (state->cbs_hasprevdirentry) {
3057 ilinkref = state->cbs_previlinkref; /* use previous */
3063 (state->cbs_result == 0) &&
3064 (state->cbs_nlinks < state->cbs_maxlinks)) {
3065 state->cbs_linkinfo[state->cbs_nlinks].dirent_addr = uiobase;
3066 state->cbs_linkinfo[state->cbs_nlinks].link_ref = ilinkref;
3067 state->cbs_nlinks++;
3069 if (state->cbs_hasprevdirentry) {
3075 if (state->cbs_flags & VNODE_READDIR_EXTENDED) {
3077 state->cbs_eof = true;
3091 tmp = state->cbs_direntry;
3092 state->cbs_direntry = state->cbs_prevdirentry;
3093 state->cbs_prevdirentry = tmp;
3094 state->cbs_hasprevdirentry = true;
3095 state->cbs_previlinkref = ilinkref;
3099 return (state->cbs_result == 0 &&
3100 uio_resid(state->cbs_uio) >= SMALL_DIRENTRY_SIZE);
3108 struct packdirentry_state *state)
3123 hfsmp = state->cbs_hfsmp;
3128 if (state->cbs_parentID != curID) {
3129 state->cbs_result = ENOENT;
3165 if (uiosize > (user_size_t)uio_resid(state->cbs_uio)) {
3169 state->cbs_result = uiomove(uioaddr, uiosize, state->cbs_uio);
3170 if (state->cbs_result == 0) {
3171 ++state->cbs_index;
3174 state->cbs_desc->cd_cnid = cnid;
3176 state->cbs_desc->cd_flags |= CD_ISDIR;
3178 state->cbs_desc->cd_flags &= ~CD_ISDIR;
3180 if (state->cbs_desc->cd_nameptr != NULL) {
3181 state->cbs_desc->cd_namelen = 0;
3183 state->cbs_desc->cd_namelen = namelen;
3184 bcopy(nameptr, state->cbs_namebuf, namelen + 1);
3188 return (state->cbs_result == 0 && uio_resid(state->cbs_uio) >= SMALL_DIRENTRY_SIZE);
3201 struct packdirentry_state state;
3228 state.cbs_flags = flags;
3229 state.cbs_hasprevdirentry = false;
3230 state.cbs_previlinkref = 0;
3231 state.cbs_nlinks = 0;
3232 state.cbs_maxlinks = maxlinks;
3233 state.cbs_linkinfo = (linkinfo_t *)((char *)buffer + MAXPATHLEN);
3239 state.cbs_eof = false;
3241 iterator = (BTreeIterator *) ((char *)state.cbs_linkinfo + (maxlinks * sizeof(linkinfo_t)));
3246 state.cbs_direntry = (struct direntry *)((char *)iterator + sizeof(BTreeIterator));
3247 state.cbs_prevdirentry = state.cbs_direntry + 1;
3313 state.cbs_index = index;
3314 state.cbs_hfsmp = hfsmp;
3315 state.cbs_uio = uio;
3316 state.cbs_desc = &dirhint->dh_desc;
3317 state.cbs_namebuf = (u_int8_t *)buffer;
3318 state.cbs_result = 0;
3319 state.cbs_parentID = dirhint->dh_desc.cd_parentcnid;
3342 (IterateCallBackProcPtr)getdirentries_std_callback, &state);
3345 (IterateCallBackProcPtr)getdirentries_callback, &state);
3361 result = getdirentries_callback(&ckp, &crp, &state);
3365 /* Note that state.cbs_index is still valid on errors */
3366 *items = state.cbs_index - index;
3367 index = state.cbs_index;
3375 if (state.cbs_eof) {
3397 if (state.cbs_nlinks > 0) {
3402 for (i = 0; i < state.cbs_nlinks; ++i) {
3403 if (resolvelinkid(hfsmp, state.cbs_linkinfo[i].link_ref, &fileid) != 0)
3406 address = state.cbs_linkinfo[i].dirent_addr;
3427 if (state.cbs_result)
3428 result = state.cbs_result;
3449 struct position_state *state)
3453 if (state->hfsmp->hfs_flags & HFS_STANDARD)
3459 if (state->parentID != curID) {
3460 state->error = EINVAL;
3470 ++state->count;
3475 state->error = EINVAL;
3479 return (state->count < state->index);