[PATCH 1/3] hwsim: Support deleting hwsim by name.

Ben Greear greearb
Mon Oct 27 12:59:07 PDT 2014


On 10/24/2014 01:27 PM, Johannes Berg wrote:
> On Fri, 2014-10-24 at 08:37 -0700, greearb at candelatech.com wrote:
> 
>>      def destroy_radio(self, radio_id):
>> -        attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, radio_id)]
>> +        try:
>> +            int(radio_id)
>> +            attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, int(radio_id))]
>> +        except ValueError:
>> +            attrs = [netlink.NulStrAttr(HWSIM_ATTR_RADIO_NAME, radio_id)]
> 
> I'm not sure I support that "magic", in fact the valid string "0" would
> be converted to an int here. If anything, you want typeof() or
> something, but IMHO you should instead do
> 
>  def destroy_radio(self, index=None, name=None):
>     [...]
> 
> and have the caller pass it by calling
> 
>  destroy_radio(index=12345)
> or
>  destroy_radio(name="phy0")


Do you intend the command-line arguments to the script to change?

At the least, I think the old behaviour needs to continue working
as is, but I guess I could add a --by-name argument or something like that?

hwsim.py destroy --by-name vwiphy0

?

Thanks,
Ben


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com




More information about the Hostap mailing list