Lines Matching refs:idesc

193 dirscan(struct inodesc *idesc)
201 if (idesc->id_type != DATA)
202 errx(EEXIT, "wrong type to dirscan %d", idesc->id_type);
203 if (idesc->id_entryno == 0 &&
204 (idesc->id_filesize & (DIRBLKSIZ - 1)) != 0)
205 idesc->id_filesize = roundup(idesc->id_filesize, DIRBLKSIZ);
206 blksiz = idesc->id_numfrags * sblock.fs_fsize;
207 if (chkrange(idesc->id_blkno, idesc->id_numfrags)) {
208 idesc->id_filesize -= blksiz;
211 idesc->id_loc = 0;
212 for (dp = fsck_readdir(idesc); dp != NULL; dp = fsck_readdir(idesc)) {
217 idesc->id_dirp = (struct direct *)dbuf;
218 if ((n = (*idesc->id_func)(idesc)) & ALTERED) {
219 bp = getdirblk(idesc->id_blkno, blksiz);
222 memmove(bp->b_un.b_buf + idesc->id_loc - dsize, dbuf,
230 return (idesc->id_filesize > 0 ? KEEPON : STOP);
239 fsck_readdir(struct inodesc *idesc)
246 blksiz = idesc->id_numfrags * sblock.fs_fsize;
247 if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz)
249 bp = getdirblk(idesc->id_blkno, blksiz);
252 dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
258 if (idesc->id_loc % DIRBLKSIZ != 0 || dircheck(idesc, bp, dp) != 0) {
262 idesc->id_loc += dp->d_reclen;
263 idesc->id_filesize -= dp->d_reclen;
267 if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz ||
268 idesc->id_loc % DIRBLKSIZ == 0)
273 ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
274 if (dircheck(idesc, bp, ndp) != 0)
286 size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
287 idesc->id_loc += size;
288 idesc->id_filesize -= size;
289 if (idesc->id_fix == IGNORE)
298 if (dofix(idesc, "DIRECTORY CORRUPTED"))
311 dircheck(struct inodesc *idesc, struct bufarea *bp, struct direct *dp)
318 spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
323 idesc->id_filesize < size ||
451 adjust(struct inodesc *idesc, int lcnt)
457 ginode(idesc->id_number, &ip);
466 clri(idesc, "UNREF", 1);
477 if (linkup(idesc->id_number, (ino_t)0, NULL) == 0) {
479 clri(idesc, "UNREF", 0);
490 pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
508 cmd.value = idesc->id_number;
525 mkentry(struct inodesc *idesc)
527 struct direct *dirp = idesc->id_dirp;
531 newent.d_namlen = strlen(idesc->id_name);
542 dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */
544 dirp->d_type = inoinfo(idesc->id_parent)->ino_type;
546 memmove(dirp->d_name, idesc->id_name, (size_t)newent.d_namlen + 1);
551 chgino(struct inodesc *idesc)
553 struct direct *dirp = idesc->id_dirp;
555 if (memcmp(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1))
557 dirp->d_ino = idesc->id_parent;
558 dirp->d_type = inoinfo(idesc->id_parent)->ino_type;
570 struct inodesc idesc;
573 memset(&idesc, 0, sizeof(struct inodesc));
595 idesc.id_name = strdup(lfname);
596 idesc.id_type = DATA;
597 idesc.id_func = findino;
598 idesc.id_number = UFS_ROOTINO;
599 if ((ckinode(ip.i_dp, &idesc) & FOUND) != 0) {
600 lfdir = idesc.id_parent;
621 free(idesc.id_name);
647 idesc.id_type = inoinfo(oldlfdir)->ino_idtype;
648 idesc.id_func = freeblock;
649 idesc.id_number = oldlfdir;
650 adjust(&idesc, inoinfo(oldlfdir)->ino_linkcnt + 1);
706 struct inodesc idesc;
710 memset(&idesc, 0, sizeof(struct inodesc));
711 idesc.id_type = DATA;
712 idesc.id_func = chgino;
713 idesc.id_number = dir;
714 idesc.id_fix = DONTKNOW;
715 idesc.id_name = strdup(name);
716 idesc.id_parent = newnum; /* new value for name */
718 if (((error = ckinode(ip.i_dp, &idesc)) & ALTERED) && newnum != 0) {
723 free(idesc.id_name);
736 struct inodesc idesc;
743 memset(&idesc, 0, sizeof(struct inodesc));
744 idesc.id_type = DATA;
745 idesc.id_func = mkentry;
746 idesc.id_number = parent;
747 idesc.id_parent = ino; /* this is the inode to enter */
748 idesc.id_fix = DONTKNOW;
749 idesc.id_name = strdup(name);
756 if ((ckinode(dp, &idesc) & ALTERED) != 0) {
758 free(idesc.id_name);
764 free(idesc.id_name);
767 retval = ckinode(dp, &idesc) & ALTERED;
769 free(idesc.id_name);
782 struct inodesc idesc;
789 memset(&idesc, 0, sizeof(struct inodesc));
790 idesc.id_type = ADDR;
834 idesc.id_blkno = oldblk;
835 idesc.id_numfrags = numfrags(&sblock, lastlbnsize);
836 (void)freeblock(&idesc);
894 idesc.id_blkno = newblk;
895 idesc.id_numfrags = sblock.fs_frag;
896 (void)freeblock(&idesc);
899 idesc.id_blkno = indirblk;
900 idesc.id_numfrags = sblock.fs_frag;
901 (void)freeblock(&idesc);