Closed zhaozg closed 9 years ago
In general it looks like it will work for my use case, I'm still (of course) favorable to my own patch, in this case because it's fewer lines of code, but if this is code which I do not maintain, I'm happy with that so +1 in theory. If you feel like patching https://github.com/cjdelisle/cjdns/blob/master/interface/tuntap/windows/TAPInterface.c to work with your version then I'll really love you :)
Before getting into reviewing any code, I'd like to hear some general thoughts from @indutny, @bnoordhuis and @piscisaureus.
The approach taken here looks clean and nice to me, if that's enough for people wanting to use serial devices (for example) not to (ab)use uv_fs_open, I'm all in :-)
Thanks @zhaozg! I did an initial review of the code (I didn't cover it all yet though).
OK, now I update finished according to libvu style, and thanks @saghul very much.
@zhaozg amazing. And, are you going integrate device stream to node.js ?
not node.js, but luvit https://github.com/luvit/luvit
Sorry, have to cut the review short. At a quick glance, I notice there are a bunch of style errors in the test but nothing worse.
thanks @bnoordhuis, code updated.
Without having really followed this conversation except to periodically sweep the mess of mail out of my inbox, I thought perhaps you would enjoy reading parkinson's law :)
@cjdelisle :-)
@saghul I should make a new RP to libuv/libuv?
If you don't mind, that would be great! On Nov 29, 2014 5:21 AM, "George Zhao" notifications@github.com wrote:
@saghul https://github.com/saghul I should make a new RP to libuv/libuv?
— Reply to this email directly or view it on GitHub https://github.com/joyent/libuv/pull/1580#issuecomment-64941097.
Close this RP, because replaced with https://github.com/libuv/libuv/pull/19.
I'm a multi-language programmer, but not family with english, so maybe trouble with options. libuv is a good i/o framework, and easy to extent, I hope persist on it to do my work.
When I want to do r/w device on windows, I try filesystem api, it works for device handle, but not fit my needs. I need a real stream, I try wrap handle as pipe, and fail to work. When I study TTY and TCP, I realize that it not hard to implication a device type stream, because just file operation with overlapped, even simpler than other stream types. When I finish my job on windows, i realize libUV is born for linux, simple to add a device type, so i did it.
There are only three type related api.
uv_device_init will init and create a uv_deive_t, path should be '/dev/??' on linux or ".\Global\???" on windows. flags should be O_RDONLY,O_WRONLY or O_RDWR.
uv_device_ioctl will set or get device paramater, arg is relative with OS platform, return >=0 for success, detail please see header file.
because not test widely, so maybe have bugs, please attention.
Happy for do something for libUV.