- size_t i;
-
- printf ("Inode %"PRDSNu": %"PRDSNu" bytes, %zu sectors (",
- idx->sector, idx->data.length, idx->data.sector_cnt);
-
- /* This loop could be unsafe for large idx->data.sector_cnt, can
- you see why? */
- for (i = 0; i < idx->data.sector_cnt; i++)
- {
- if (i != 0)
- printf (", ");
- printf ("%"PRDSNu, idx->data.sectors[i]);
- }
- printf (")\n");
-}
-\f
-/* Returns a newly allocated and initialized inode. */
-static struct inode *
-alloc_inode (disk_sector_t sector)
-{
- /* Allocate memory. */
- struct inode *idx = calloc (1, sizeof *idx);
- if (idx == NULL)
- return NULL;
-
- /* Initialize. */
- list_push_front (&open_inodes, &idx->elem);
- idx->sector = sector;
- idx->open_cnt = 1;
- idx->removed = false;
-
- return idx;
+ ASSERT (idx != NULL);
+ printf ("Inode %"PRDSNu": %"PRDSNu" bytes, "
+ "%zu sectors starting at %"PRDSNu"\n",
+ idx->sector, idx->data.length,
+ (size_t) DIV_ROUND_UP (idx->data.length, DISK_SECTOR_SIZE),
+ idx->data.start);