On 11/11/2010 10:39 AM, Daniel P. Berrange wrote:
IIUC, the FDs sent/received via struct cmsghdr are in a strictly
ordered array, so why not just define a placeholder syntax for
the commands that maps to the array indexes. eg
netdev_add tap,fd=$0,vhost_fd=$1,id=hostnet0
The '$' sign is not valid for a normal FD number, so use of a $0,
$1, $2, etc can reliably be substituted with the real FD number from
the cmsghdr array elements 0, 1, 2, etc
Character devices are streaming so it's hard to refer to array indexes
in a single message. You could count it for the entire session but
session boundaries aren't really well defined.
I don't think it's an obvious win.
Regards,
Anthony Liguori
Regards,
Daniel