Lines Matching refs:dp

191 	struct inode *dp;		/* inode for directory being searched */
204 doff_t prevoff; /* prev entry dp->i_offset */
205 struct vnode *pdp; /* saved dp during symlink work */
219 dp = VTOI(vdp);
220 if (dp->i_effnlink == 0)
229 vnode_create_vobject(vdp, DIP(dp, i_size), curthread);
266 i_diroff = dp->i_diroff;
282 if (ufsdirhash_build(dp) == 0) {
284 enduseful = dp->i_size;
286 slotoffset = ufsdirhash_findfree(dp, slotneeded,
290 enduseful = ufsdirhash_enduseful(dp);
292 enduseful = dp->i_size;
298 switch (ufsdirhash_lookup(dp, cnp->cn_nameptr, cnp->cn_namelen,
305 i_offset = roundup2(dp->i_size, DIRBLKSIZ);
324 if (nameiop != LOOKUP || i_diroff == 0 || i_diroff >= dp->i_size) {
337 endsearch = roundup2(dp->i_size, DIRBLKSIZ);
376 ufs_dirbad(dp, i_offset, "mangled entry");
440 enduseful = dp->i_size;
477 (flags & ISLASTCN) && dp->i_effnlink != 0) {
493 * then set dp->i_count to 0 indicating
496 * can be put in the range from dp->i_offset to
497 * dp->i_offset + dp->i_count.
500 SET_I_OFFSET(dp, roundup2(dp->i_size, DIRBLKSIZ));
501 SET_I_COUNT(dp, 0);
502 enduseful = I_OFFSET(dp);
504 SET_I_OFFSET(dp, slotoffset);
505 if ((I_OFFSET(dp) & (DIRBLKSIZ - 1)) == 0)
506 SET_I_COUNT(dp, 0);
508 SET_I_COUNT(dp, I_OFFSET(dp) - prevoff);
510 SET_I_OFFSET(dp, slotoffset);
511 SET_I_COUNT(dp, slotsize);
515 SET_I_ENDOFF(dp, roundup2(enduseful, DIRBLKSIZ));
545 if (i_offset + DIRSIZ(OFSFMT(vdp), ep) > dp->i_size) {
546 ufs_dirbad(dp, i_offset, "i_size too small");
558 dp->i_diroff = rounddown2(i_offset, DIRBLKSIZ);
571 * dp->i_offset, and distance past previous
573 * block) in dp->i_count.
580 SET_I_OFFSET(dp, i_offset);
581 if ((I_OFFSET(dp) & (DIRBLKSIZ - 1)) == 0)
582 SET_I_COUNT(dp, 0);
584 SET_I_COUNT(dp, I_OFFSET(dp) - prevoff);
601 if (dp->i_number == ino) {
629 SET_I_OFFSET(dp, i_offset);
630 if (dp->i_number == ino)
711 } else if (dp->i_number == ino) {
771 ufs_dirbadentry(struct vnode *dp, struct direct *ep, int entryoffsetinblock)
776 if (OFSFMT(dp))
785 ep->d_reclen < DIRSIZ(OFSFMT(dp), ep) || namlen > UFS_MAXNAMLEN) {
843 * which was left locked by namei. Remaining parameters (dp->i_offset,
844 * dp->i_count) indicate how the space for the new entry is to be obtained.
855 struct inode *dp;
866 dp = VTOI(dvp);
869 if (I_COUNT(dp) == 0) {
871 * If dp->i_count is 0, then namei could find no
872 * space in the directory. Here, dp->i_offset will
876 if (I_OFFSET(dp) & (DIRBLKSIZ - 1))
882 if ((error = getinoquota(dp)) != 0) {
888 old_isize = dp->i_size;
890 (vm_ooffset_t)I_OFFSET(dp) + DIRBLKSIZ);
891 if ((error = UFS_BALLOC(dvp, (off_t)I_OFFSET(dp), DIRBLKSIZ,
898 dp->i_size = I_OFFSET(dp) + DIRBLKSIZ;
899 DIP_SET(dp, i_size, dp->i_size);
900 SET_I_ENDOFF(dp, dp->i_size);
901 UFS_INODE_SET_FLAG(dp, IN_SIZEMOD | IN_CHANGE | IN_UPDATE);
903 blkoff = I_OFFSET(dp) &
907 if (dp->i_dirhash != NULL) {
908 ufsdirhash_newblk(dp, I_OFFSET(dp));
909 ufsdirhash_add(dp, dirp, I_OFFSET(dp));
910 ufsdirhash_checkblock(dp, (char *)bp->b_data + blkoff,
911 I_OFFSET(dp));
927 if (softdep_setup_directory_add(bp, dp, I_OFFSET(dp),
929 UFS_INODE_SET_FLAG(dp, IN_NEEDSYNC);
947 * If dp->i_count is non-zero, then namei found space for the new
948 * entry in the range dp->i_offset to dp->i_offset + dp->i_count
962 if (I_OFFSET(dp) + I_COUNT(dp) > dp->i_size) {
963 dp->i_size = I_OFFSET(dp) + I_COUNT(dp);
964 DIP_SET(dp, i_size, dp->i_size);
965 UFS_INODE_SET_FLAG(dp, IN_SIZEMOD | IN_MODIFIED);
970 error = UFS_BLKATOFF(dvp, (off_t)I_OFFSET(dp), &dirbuf, &bp);
979 * arranged that compacting the region dp->i_offset to
980 * dp->i_offset + dp->i_count would yield the space.
985 for (loc = ep->d_reclen; loc < I_COUNT(dp); ) {
1011 if (dp->i_dirhash != NULL)
1012 ufsdirhash_move(dp, nep,
1013 I_OFFSET(dp) + ((char *)nep - dirbuf),
1014 I_OFFSET(dp) + ((char *)ep - dirbuf));
1017 softdep_change_directoryentry_offset(bp, dp, dirbuf,
1053 if (dp->i_dirhash != NULL && (ep->d_ino == 0 ||
1055 ufsdirhash_add(dp, dirp, I_OFFSET(dp) + ((char *)ep - dirbuf));
1059 if (dp->i_dirhash != NULL)
1060 ufsdirhash_checkblock(dp, dirbuf -
1061 (I_OFFSET(dp) & (DIRBLKSIZ - 1)),
1062 rounddown2(I_OFFSET(dp), DIRBLKSIZ));
1066 (void) softdep_setup_directory_add(bp, dp,
1067 I_OFFSET(dp) + (caddr_t)ep - dirbuf,
1085 UFS_INODE_SET_FLAG(dp, IN_CHANGE | IN_UPDATE | (error == 0 &&
1086 I_ENDOFF(dp) != 0 && I_ENDOFF(dp) < dp->i_size ? IN_ENDOFF : 0));
1094 * dp->i_offset contains the offset into the directory of the
1095 * entry to be eliminated. The dp->i_count field contains the
1106 struct inode *dp;
1112 dp = VTOI(dvp);
1121 softdep_setup_unlink(dp, ip);
1129 offset = I_OFFSET(dp);
1131 offset = I_OFFSET(dp) - I_COUNT(dp);
1155 if (I_COUNT(dp) == 0)
1162 * that `ep' is the previous entry when dp->i_count != 0.
1164 if (dp->i_dirhash != NULL)
1165 ufsdirhash_remove(dp, rep, I_OFFSET(dp));
1179 if (I_COUNT(dp) != 0) {
1187 if (dp->i_dirhash != NULL)
1188 ufsdirhash_checkblock(dp, (char *)ep -
1189 ((I_OFFSET(dp) - I_COUNT(dp)) & (DIRBLKSIZ - 1)),
1190 rounddown2(I_OFFSET(dp), DIRBLKSIZ));
1196 softdep_setup_remove(bp, dp, ip, isrmdir);
1209 UFS_INODE_SET_FLAG(dp, IN_CHANGE | IN_UPDATE);
1226 ufs_dirrewrite(struct inode *dp, struct inode *oip, ino_t newinum, int newtype,
1231 struct vnode *vdp = ITOV(dp);
1241 softdep_setup_unlink(dp, oip);
1248 error = UFS_BLKATOFF(vdp, (off_t)I_OFFSET(dp), (char **)&ep, &bp);
1270 softdep_setup_directory_change(bp, dp, oip, newinum, isrmdir);
1280 UFS_INODE_SET_FLAG(dp, IN_CHANGE | IN_UPDATE);
1305 struct direct *dp = (struct direct *)&dbuf;
1310 for (off = 0; off < ip->i_size; off += dp->d_reclen) {
1311 error = vn_rdwr(UIO_READ, ITOV(ip), (caddr_t)dp, MINDIRSIZ,
1321 if (dp->d_reclen == 0)
1324 if (dp->d_ino == 0 || dp->d_ino == UFS_WINO)
1329 namlen = dp->d_type;
1331 namlen = dp->d_namlen;
1333 namlen = dp->d_namlen;
1337 if (dp->d_name[0] != '.')
1344 if (namlen == 1 && dp->d_ino == ip->i_number)
1346 if (dp->d_name[1] == '.' && dp->d_ino == parentino)