* Copyright (c) 1991 Regents of the University of California.
* %sccs.include.redist.c%
* @(#)lfs_subr.c 7.2 (Berkeley) %G%
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
#include <ufs/lfs/lfs_extern.h>
* Return buffer with the contents of block "offset" from the beginning of
* directory "ip". If "res" is non-zero, fill it in with a pointer to the
* remaining space in the directory.
lfs_blkatoff(ip
, offset
, res
, bpp
)
lbn
= lblkno(fs
, offset
);
if (error
= bread(ITOV(ip
), lbn
, bsize
, NOCRED
, &bp
)) {
*res
= bp
->b_un
.b_addr
+ blkoff(fs
, offset
);
/* Return the current version number for a specific inode. */
* Read the appropriate block from the ifile. Return the
LFS_IENTRY(ifp
, fs
, ino
, bp
);
version
= ifp
->if_version
;
/* Search a block for a specific dinode. */
printf("lfs_ifind: inode %d\n", ino
);
for (cnt
= INOPB(fs
); cnt
--; ++dip
)
panic("lfs_ifind: dinode %u not found", ino
);
/* Set values in the ifile for the inode. */
lfs_iset(ip
, daddr
, atime
)
printf("lfs_iset: setting ino %d daddr %lx time %lx\n",
ip
->i_number
, daddr
, atime
);
LFS_IENTRY(ifp
, fs
, ino
, bp
);
ifp
->if_st_atime
= atime
;
/* Translate an inode number to a disk address. */
/* Read the appropriate block from the ifile. */
LFS_IENTRY(ifp
, fs
, ino
, bp
);
if (ifp
->if_daddr
== LFS_UNUSED_DADDR
)
panic("itod: unused disk address");