Lines Matching defs:psn
59 allocdirs(struct psshfs_node *psn)
61 size_t oldtot = psn->denttot;
63 psn->denttot += ENTRYCHUNK;
64 psn->dir = erealloc(psn->dir,
65 psn->denttot * sizeof(struct psshfs_dir));
66 memset(psn->dir + oldtot, 0, ENTRYCHUNK * sizeof(struct psshfs_dir));
74 struct psshfs_node *psn = pn->pn_data;
94 psn->attrread = time(NULL);
133 closehandles(struct puffs_usermount *pu, struct psshfs_node *psn, int which)
139 if (psn->fhand_r && (which & HANDLE_READ)) {
140 assert(psn->lazyopen_r == NULL);
145 psn->fhand_r, psn->fhand_r_len);
147 free(psn->fhand_r);
148 psn->fhand_r = NULL;
151 if (psn->fhand_w && (which & HANDLE_WRITE)) {
152 assert(psn->lazyopen_w == NULL);
157 psn->fhand_w, psn->fhand_w_len);
159 free(psn->fhand_w);
160 psn->fhand_w = NULL;
163 psn->stat |= PSN_HANDLECLOSE;
170 struct psshfs_node *psn = arg;
173 if (psn->stat & PSN_RECLAIMED) {
180 error = psbuf_expect_handle(pb, &psn->fhand_r, &psn->fhand_r_len);
183 psn->lazyopen_err_r = error;
184 psn->lazyopen_r = NULL;
186 psn->stat &= ~PSN_DOLAZY_R;
187 if (psn->stat & PSN_HANDLECLOSE && (psn->stat & PSN_LAZYWAIT_R) == 0)
188 closehandles(pu, psn, HANDLE_READ);
197 struct psshfs_node *psn = arg;
200 if (psn->stat & PSN_RECLAIMED) {
207 error = psbuf_expect_handle(pb, &psn->fhand_w, &psn->fhand_w_len);
210 psn->lazyopen_err_w = error;
211 psn->lazyopen_w = NULL;
213 psn->stat &= ~PSN_DOLAZY_W;
214 if (psn->stat & PSN_HANDLECLOSE && (psn->stat & PSN_LAZYWAIT_W) == 0)
215 closehandles(pu, psn, HANDLE_WRITE);
221 struct psshfs_node *psn;
244 struct psshfs_node *psn = pn->pn_data;
248 if (!psn->attrread || REFRESHTIMEOUT(pctx, time(NULL)-psn->attrread)) {
264 struct psshfs_node *psn = pn->pn_data;
277 olddir = psn->dir;
278 nent = psn->dentnext;
280 if (psn->dir && psn->dentread
281 && !REFRESHTIMEOUT(pctx, time(NULL) - psn->dentread))
284 if (psn->dentread) {
310 psn->dentread = time(NULL);
312 psn->dentnext = 0;
313 psn->denttot = 0;
314 psn->dir = NULL;
332 if (idx == psn->denttot)
333 allocdirs(psn);
335 &psn->dir[idx].entryname, NULL)))
339 if ((rv = psbuf_get_vattr(pb, &psn->dir[idx].va)) != 0)
342 &psn->dir[idx].va.va_nlink) != 1) {
353 if (strcmp(psn->dir[idx].entryname, ".") == 0) {
354 setpnva(pu, pn, &psn->dir[idx].va);
362 testd = lookup(olddir, nent, psn->dir[idx].entryname);
364 psn->dir[idx].entry = testd->entry;
371 &psn->dir[idx].va);
372 psn->dir[idx].va.va_fileid
388 psn->dir[idx].va.va_fileid
390 testd->va = psn->dir[idx].va;
395 psn->dir[idx].entry = NULL;
396 psn->dir[idx].va.va_fileid = pctx->nextino++;
398 psn->dir[idx].attrread = psn->dentread;
399 psn->dir[idx].valid = 1;
405 psn->dentnext = idx;
427 struct psshfs_node *psn;
430 psn = emalloc(sizeof(struct psshfs_node));
431 memset(psn, 0, sizeof(struct psshfs_node));
433 pn = puffs_pn_new(pu, psn);
435 free(psn);
440 psn->attrread = pd->attrread;
442 psn->parent = parent;
445 TAILQ_INIT(&psn->pw);
502 struct psshfs_node *psn = pn->pn_data;
506 psn_parent = psn->parent->pn_data;
520 freedircache(psn->dir, psn->dentnext);
521 psn->denttot = psn->dentnext = 0;
523 if (psn->symlink)
524 free(psn->symlink);
532 struct psshfs_node *psn, *psn_parent;
535 psn = node->pn_data;
536 psn_parent = psn->parent->pn_data;
544 psn->parent->pn_va.va_nlink--;