Lines Matching refs:offset

96 static void ufsdirhash_adjfree(struct dirhash *dh, doff_t offset, int diff);
99 doff_t offset);
100 static doff_t ufsdirhash_getprev(struct direct *dp, doff_t offset);
536 * Find the offset of the specified name within the given inode.
540 * If successful, the directory offset is stored in *offp, and a
542 * prevoffp is non-NULL, the offset of the previous entry within
556 doff_t blkoff, bmask, offset, prevoff, seqoff;
603 * offset of the directory entry immediately following
604 * the last entry that was looked up. Check if this offset
607 for (i = slot; (offset = DH_ENTRY(dh, i)) != DIRHASH_EMPTY;
609 if (offset == seqoff)
611 if (offset == seqoff) {
613 * We found an entry with the expected offset. This
622 for (; (offset = DH_ENTRY(dh, slot)) != DIRHASH_EMPTY;
624 if (offset == DIRHASH_DEL)
626 if (offset < 0 || offset >= ip->i_size)
627 panic("ufsdirhash_lookup: bad offset in hash array");
628 if ((offset & ~bmask) != blkoff) {
631 blkoff = offset & ~bmask;
638 dp = (struct direct *)(bp->b_data + (offset & bmask));
640 DIRBLKSIZ - (offset & (DIRBLKSIZ - 1))) {
647 /* Found. Get the prev offset if needed. */
649 if (offset & (DIRBLKSIZ - 1)) {
651 offset);
657 prevoff = offset;
661 /* Update offset. */
662 dh->dh_seqoff = offset + DIRSIZ(0, dp);
664 *offp = offset;
688 * the offset of the directory entry that begins the free space.
689 * This will either be the offset of an existing entry that has free
690 * space at the end, or the offset of an entry with d_ino == 0 at
697 * region beginning at the returned offset and spanning *slotsize bytes.
801 * points to a struct direct containing the entry, and offset specifies
802 * the offset of this entry.
805 ufsdirhash_add(struct inode *ip, struct direct *dirp, doff_t offset)
813 KASSERT(offset < dh->dh_dirblks * DIRBLKSIZ,
814 ("ufsdirhash_add: bad offset"));
830 DH_ENTRY(dh, slot) = offset;
836 ufsdirhash_adjfree(dh, offset, -DIRSIZ(0, dirp));
843 * `offset' within the directory.
846 ufsdirhash_remove(struct inode *ip, struct direct *dirp, doff_t offset)
854 KASSERT(offset < dh->dh_dirblks * DIRBLKSIZ,
855 ("ufsdirhash_remove: bad offset"));
857 slot = ufsdirhash_findslot(dh, dirp->d_name, dirp->d_namlen, offset);
863 ufsdirhash_adjfree(dh, offset, DIRSIZ(0, dirp));
868 * Change the offset associated with a directory entry in the hash. Used
883 ("ufsdirhash_move: bad offset"));
884 /* Find the entry, and update the offset. */
892 * begins at offset (i.e. the new length is offset + DIRBLKSIZ).
895 ufsdirhash_newblk(struct inode *ip, doff_t offset)
903 KASSERT(offset == dh->dh_dirblks * DIRBLKSIZ,
904 ("ufsdirhash_newblk: bad offset"));
905 block = offset / DIRBLKSIZ;
924 ufsdirhash_dirtrunc(struct inode *ip, doff_t offset)
932 KASSERT(offset <= dh->dh_dirblks * DIRBLKSIZ,
933 ("ufsdirhash_dirtrunc: bad offset"));
934 block = howmany(offset, DIRBLKSIZ);
969 * DIRBLKSIZ-sized directory block, and `offset' should contain the
970 * offset from the start of the directory of that block.
973 ufsdirhash_checkblock(struct inode *ip, char *buf, doff_t offset)
984 block = offset / DIRBLKSIZ;
985 if ((offset & (DIRBLKSIZ - 1)) != 0 || block >= dh->dh_dirblks)
986 panic("ufsdirhash_checkblock: bad offset");
1010 ufsdirhash_findslot(dh, dp->d_name, dp->d_namlen, offset + i);
1049 * Adjust the number of free bytes in the block containing `offset'
1057 ufsdirhash_adjfree(struct dirhash *dh, doff_t offset, int diff)
1062 block = offset / DIRBLKSIZ;
1064 ("dirhash bad offset"));
1087 * Find the specified name which should have the specified offset.
1093 ufsdirhash_findslot(struct dirhash *dh, char *name, int namelen, doff_t offset)
1102 while (DH_ENTRY(dh, slot) != offset &&
1105 if (DH_ENTRY(dh, slot) != offset)
1141 * Given a directory entry and its offset, find the offset of the
1143 * offset, or -1 if there is no previous entry in the block or some
1147 ufsdirhash_getprev(struct direct *dirp, doff_t offset)
1154 blkoff = rounddown2(offset, DIRBLKSIZ); /* offset of start of block */
1155 entrypos = offset & (DIRBLKSIZ - 1); /* entry relative to block */
1159 /* If `offset' is the start of a block, there is no previous entry. */