Add gdevice_count to gdev API

And support barra.