-/* Free an inode. */
-void
-lfs_ifree(ip)
- INODE *ip;
-{
- BUF *bp;
- IFILE *ifp;
- LFS *fs;
- ino_t ino;
-
-printf("lfs_ifree: free %d\n", ip->i_number);
- /* Get the inode number and file system. */
- fs = ip->i_lfs;
- ino = ip->i_number;
-
- /*
- * Read the appropriate block from the ifile. Set the inode entry to
- * unused, increment its version number and link it into the free chain.
- */
- LFS_IENTRY(ifp, fs, ino, bp);
- ifp->if_daddr = LFS_UNUSED_DADDR;
- ++ifp->if_version;
- ifp->if_nextfree = fs->lfs_free;
- fs->lfs_free = ino;
-
- lfs_bwrite(bp);
-
- /* Set superblock modified bit and decrement file count. */
- fs->lfs_fmod = 1;
- --fs->lfs_nfiles;
-}
-
-/* Translate an inode number to a disk address. */
-daddr_t
-itod(fs, ino)
- LFS *fs;
- ino_t ino;
-{
- BUF *bp;
- IFILE *ifp;
- daddr_t iaddr;
-
- /* 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");
- iaddr = ifp->if_daddr;
- brelse(bp);
- return (iaddr);
-}
-
-/* Search a block for a specific dinode. */
-DINODE *
-lfs_ifind(fs, ino, page)
- LFS *fs;
- ino_t ino;
- void *page;
-{
- register DINODE *dip;
- register int cnt;
-
-printf("lfs_ifind: inode %d\n", ino);
- dip = page;
- for (cnt = INOPB(fs); cnt--; ++dip)
- if (dip->di_inum == ino)
- return (dip);
-
- panic("lfs_ifind: dinode %%u not found", ino);
- /* NOTREACHED */
-}
-