by Mike Grupenhoff <kashmir@umiacs.umd.edu> in PR #2485. While I'm here, do some long-overdue cleanup, including function prototypes, and update for modern libkvm interfaces.