DIRBLKSIZ
struct ext2fs_dirtemplate emptydir = { 0, DIRBLKSIZ };
0, DIRBLKSIZ - 12, 2, EXT2_FT_DIR, ".."
(idesc->id_filesize & (DIRBLKSIZ - 1)) != 0)
idesc->id_filesize = roundup(idesc->id_filesize, DIRBLKSIZ);
if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
dp->d_reclen = DIRBLKSIZ;
idesc->id_loc += DIRBLKSIZ;
idesc->id_filesize -= DIRBLKSIZ;
if ((idesc->id_loc % DIRBLKSIZ) == 0)
size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
if (DIP(dp, di_size) % DIRBLKSIZ) {
DIP_SET(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ));
char *cp, firstblk[DIRBLKSIZ];
struct dirtemplate emptydir = { 0, DIRBLKSIZ };
memcpy(firstblk, bp->b_un.b_buf, DIRBLKSIZ);
memcpy(bp->b_un.b_buf, firstblk, DIRBLKSIZ);
for (cp = &bp->b_un.b_buf[DIRBLKSIZ];
cp += DIRBLKSIZ)
0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
for (cp = &bp->b_un.b_buf[DIRBLKSIZ];
cp += DIRBLKSIZ)
char dbuf[DIRBLKSIZ];
inp->i_isize = roundup(MINDIRSIZE, DIRBLKSIZ);
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
DIRBLKSIZ);
inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
spcleft = DIRBLKSIZ;
return (DIRBLKSIZ);
i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1));
char dirbuf[DIRBLKSIZ];
if (dirloc + dp->d_reclen > DIRBLKSIZ) {
DIRBLKSIZ - prev;
(void)fwrite(dirbuf, 1, DIRBLKSIZ, df);
((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev;
(void)lseek(dirp->dd_fd, base + (loc & ~(DIRBLKSIZ - 1)), SEEK_SET);
dirp->dd_loc = loc & (DIRBLKSIZ - 1);
dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ);
DIRBLKSIZ);
dp->d_reclen > DIRBLKSIZ + 1 - dirp->dd_loc) {
char dd_buf[DIRBLKSIZ];
dirbuflen = DIRBLKSIZ;
siz = ((cnt + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
ufs_mindirhashsize = 5 * DIRBLKSIZ;
DIRHASH_ASSERT(DIP(ip, size) >= DIRBLKSIZ, ("ufsdirhash_build size"));
dirblocks = howmany(DIP(ip, size), DIRBLKSIZ);
dh->dh_blkfree[i] = DIRBLKSIZ / DIRALIGN;
DIRBLKSIZ - (pos & (DIRBLKSIZ - 1))) {
DIRBLKSIZ - (offset & (DIRBLKSIZ - 1))) {
if (offset & (DIRBLKSIZ - 1)) {
pos = dirblock * DIRBLKSIZ;
for (i = 0; i < DIRBLKSIZ; ) {
if (i > DIRBLKSIZ) {
while (i < DIRBLKSIZ && freebytes < slotneeded) {
if (i > DIRBLKSIZ) {
if (dh->dh_blkfree[dh->dh_dirblks - 1] != DIRBLKSIZ / DIRALIGN) {
if (dh->dh_blkfree[i] != DIRBLKSIZ / DIRALIGN)
return ((doff_t)(i + 1) * DIRBLKSIZ);
DIRHASH_ASSERT(offset < dh->dh_dirblks * DIRBLKSIZ,
DIRHASH_ASSERT(offset < dh->dh_dirblks * DIRBLKSIZ,
DIRHASH_ASSERT(oldoff < dh->dh_dirblks * DIRBLKSIZ &&
newoff < dh->dh_dirblks * DIRBLKSIZ,
DIRHASH_ASSERT(offset == dh->dh_dirblks * DIRBLKSIZ,
block = offset / DIRBLKSIZ;
dh->dh_blkfree[block] = DIRBLKSIZ / DIRALIGN;
DIRHASH_ASSERT(offset <= dh->dh_dirblks * DIRBLKSIZ,
block = howmany(offset, DIRBLKSIZ);
if (dh->dh_blkfree[i] != DIRBLKSIZ / DIRALIGN)
block = offset / DIRBLKSIZ;
if ((offset & (DIRBLKSIZ - 1)) != 0 || block >= dh->dh_dirblks)
for (i = 0; i < DIRBLKSIZ; i += dp->d_reclen) {
if (dp->d_reclen == 0 || i + dp->d_reclen > DIRBLKSIZ)
if (i != DIRBLKSIZ)
block = offset / DIRBLKSIZ;
blkoff = offset & ~(DIRBLKSIZ - 1); /* offset of start of block */
entrypos = offset & (DIRBLKSIZ - 1); /* entry relative to block */
dp->i_offset = roundup2(DIP(dp, size), DIRBLKSIZ);
endsearch = roundup(DIP(dp, size), DIRBLKSIZ);
(entryoffsetinblock & (DIRBLKSIZ - 1)) == 0) {
i = DIRBLKSIZ - (entryoffsetinblock & (DIRBLKSIZ - 1));
dp->i_offset = roundup(DIP(dp, size), DIRBLKSIZ);
if ((dp->i_offset & (DIRBLKSIZ - 1)) == 0)
dp->i_endoff = roundup(enduseful, DIRBLKSIZ);
dp->i_diroff = dp->i_offset &~ (DIRBLKSIZ - 1);
if ((dp->i_offset & (DIRBLKSIZ - 1)) == 0)
ep->d_reclen > DIRBLKSIZ - (entryoffsetinblock & (DIRBLKSIZ - 1)) ||
if (dp->i_offset & (DIRBLKSIZ - 1))
if ((error = UFS_BUF_ALLOC(dp, (off_t)dp->i_offset, DIRBLKSIZ,
DIP_ASSIGN(dp, size, dp->i_offset + DIRBLKSIZ);
dirp->d_reclen = DIRBLKSIZ;
(dp->i_offset & (DIRBLKSIZ - 1)),
dp->i_offset & ~(DIRBLKSIZ - 1));
((dp->i_offset - dp->i_count) & (DIRBLKSIZ - 1)),
dp->i_offset & ~(DIRBLKSIZ - 1));
if ((error = UFS_BUF_ALLOC(ip, (off_t)0, DIRBLKSIZ, cnp->cn_cred,
DIP_ASSIGN(ip, size, DIRBLKSIZ);
entries = (uio->uio_offset + count) & (DIRBLKSIZ - 1);
0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
if (this + curdirsize > roundup(curdirsize, DIRBLKSIZ)) \
curdirsize = roundup(curdirsize, DIRBLKSIZ); \
if (de.d_reclen + dbuf->cur + llen > roundup(dbuf->size, DIRBLKSIZ)) {
newbuf = erealloc(dbuf->buf, dbuf->size + DIRBLKSIZ);
dbuf->size += DIRBLKSIZ;
memset(dbuf->buf + dbuf->size - DIRBLKSIZ, 0, DIRBLKSIZ);
dbuf->cur = dbuf->size - DIRBLKSIZ;