-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: uv_fs_{open,read,close}_dir #416
Conversation
cc'ing the required people... |
Pinging @saghul @piscisaureus @bnoordhuis again :) |
Sorry, but I won't be able to review this anytime soon. |
10b03ef
to
99ef9fe
Compare
+1 — nice work. |
@whitlockjc I opened a related issue on the nodejs bug tracker. Without having a stake in this, can you rebase this, so it will be possible to review? |
You got it. I didn't realize this hadn't been merged. |
@saghul marked it v2 - maybe that was the reason. Not sure if it is though. If possible try not breaking ABI, then I guess it'll be easier to land. Would be really useful to land this, imo! |
It looks like its only adding additional API calls, how is it breaking anything? |
I am sure @saghul will clarify. Maybe it was just for roadmap. |
It's been through a ton of review, there are tests and the ABI was not broken so that's why I was surprised. I'm not sure why it's marked as Maybe @saghul can chime in. |
@eljefedelrodeodeljefe Do you mind linking this issue and the one in node? That would be very useful. |
You mean me probably, right? It's about providing glob, where those APIs would be necessary nodejs/node#6677 |
Sorry about that, I see it was linked higher in the discussion but I didn't see it. |
This PR modifies the |
@@ -1096,6 +1104,9 @@ struct uv_fs_s { | |||
void* ptr; | |||
const char* path; | |||
uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ | |||
const uv_dir_t* dir; /* Stores the result of uv_fs_opendir() */ | |||
uv_dirent_t* dirents; | |||
size_t nentries; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's possible without that addition, say with an own struct right? That of course breaks ABI compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I didn't see this. (I actually overlooked it twice because of the styling of the GitHub diff viewer...and this PR is pretty old so I just forgot.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And where would you put those members or the new struct? FYI, I'll be -1 on bending over backwards for ABI compatibility in new features. That way we'd never start working on v2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add methods similar to uv_fs_get_statbuf
etc. from 0d6525a ?
Doh...I stand corrected. (It's been quite a while since this was authored so I guess I forgot, and GitHub's diff viewer didn't help too much as I overlooked it.) Well, it all makes sense now. Mark that up as two |
That's fine. We'll get there. Give me a ping when I can support. |
You got it. I don't mind helping on the node side of things either if you need. I'm already prepared for the node changes related to for #590 when the time comes. :) |
@whitlockjc One last comment - I believe that for Linux you need to have a mutex per dir since See what the readdir(3) docs has to say:
|
I thought something similar but figured it would come up in review. Glad you brought it up. I'll get it sorted once I've given enough soak time for further review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite ready yet but getting closer. Thanks for picking this up again.
Question: the use of req->ptr
seems unnecessary. Can that be dropped?
non_empty_readdir_cb); | ||
} | ||
|
||
uv_fs_req_cleanup(req); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't safe, is it? req == &readdir_req
and that's (re)initialized on line 375.
Ping @whitlockjc. This is so close to finally being ready 😄 |
I'll get on it. I was waiting on #590 to be merged and forgot about this one. |
@whitlockjc ping, just making sure this hasn't slipped through the cracks |
Thanks for the bump @rijnhard, I've just been super busy. I'll make time for this by EOW. |
@whitlockjc ping |
I'm back, sorry for the delay. Work, life and other OSS. :) |
Would anyone else like to pick this up and drive it? The review feedback from @guymguym and @bnoordhuis is going to take more time than I can seem to come up with right now. |
I'll pick this up. |
@cjihrig Let me know if I can help too |
Do we know where |
This died again didn't it |
It hasn't died again. I promise. |
This commit also updates `uv__fs_readdir` to use `readdir` instead of the deprecated `readdir_r`. Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
This commit also updates `uv__fs_readdir()` to use `readdir()` instead of the deprecated `readdir_r()`. Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
Moving to #2057 with most of @bnoordhuis nits addressed from the last review, as well as some comments of my own. |
This commit also updates `uv__fs_readdir()` to use `readdir()` instead of the deprecated `readdir_r()`. Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
This commit also updates `uv__fs_readdir()` to use `readdir()` instead of the deprecated `readdir_r()`. Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: libuv#2057 Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: libuv#2057 Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
Co-authored-by: Julien Gilli <jgilli@nodejs.org> Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: libuv#2057 Refs: joyent/libuv#1430 Refs: joyent/libuv#1521 Refs: joyent/libuv#1574 Refs: libuv#175 Refs: nodejs/node#583 Refs: libuv#416 Refs: libuv#170
This PR is for taking the efforts by @misterdjules in #175 and applying those changes to
master
instead ofv1.x
per @saghul's suggestion. You should be able to close #175 in favor of this but I'll leave that decision up to you.Note: This commit also updates
uv__fs_readdir
to usereaddir
instead of the deprecatedreaddir_r
.