[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] question with bt_ioctl in bluetooth.c



   Hello,all
   When i read bluetooth.c file from axis,I have a question with bt_ioctl.In the note,they said "The direction is a bitmask, and VERIFY_WRITE catches R/W transfer.'Type' is user-oriented, while verify_area is kernel-oriented, so the concept of "read"and "write" is reversed".
   But below that,they wrote
if (_IOC_DIR(cmd) & _IOC_READ) {
	err = verify_area(VERIFY_READ, (void*)arg, size);
	if (err) 
          BT_DRIVER("verify_area(VERIFY_READ) error:%d\n",err);
} else if (_IOC_DIR(cmd) & _IOC_WRITE) {
	err = verify_area(VERIFY_WRITE, (void*)arg, size);
	if (err)
	BT_DRIVER("verify_area(VERIFY_WRITE) error:%d\n",err);
}
I think it might be
if (_IOC_DIR(cmd) & _IOC_READ) {
	err = verify_area(VERIFY_WRITE, (void*)arg, size);
	if (err)
	BT_DRIVER("verify_area(VERIFY_WRITE) error:%d\n",err);
} else if (_IOC_DIR(cmd) & _IOC_WRITE) {
	err = verify_area(VERIFY_READ, (void*)arg, size);
	if (err)
	BT_DRIVER("verify_area(VERIFY_READ) error:%d\n",err);
}
    Am i right?
Pardon me for my poor English.


______________________________________

===================================================================
新浪免费电子邮箱 (http://mail.sina.com.cn)
网里寻她千百度!没有"聊友速配",怎能"成双成对"? (http://newchat.sina.com.cn)
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com