+/* Prints a representation of H to the system console. */
+void
+filehdr_print (const struct filehdr *h)
+{
+ size_t i;
+
+ printk ("File header: %jd bytes, %zd sectors (",
+ (intmax_t) h->length, h->sector_cnt);
+
+ /* This loop could be unsafe for large h->sector_cnt, can you
+ see why? */
+ for (i = 0; i < h->sector_cnt; i++)
+ {
+ if (i != 0)
+ printk (", ");
+ printk ("%jd", (intmax_t) h->sectors[i]);
+ }
+ printk (")\n");
+}