-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-16463. Make dirent cross platform compatible #4370
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
HDFS-16463. Make dirent cross platform compatible #4370
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
6492030 to
27b3dc8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
* Reference types aren't allowed in std::variant. Thus, replacing it with the actual type. * Added documentation. * Fixed bug in NextFile() implementation.
* Need to include dirent.h inside the extern "C" block to avoid duplicate delcarations.
* The prototypes need to be under extern "C" in order prevent name mangling.
* Needed to create the root temp folder first.
* Needed to free x_platform_dirent.
* Need to clear the d_name char buffer to avoid invalid subsequent writes.
* Need to return the absolute paths for comparison of ListDirAndFiles.
* Added a USE_X_PLATFORM_DIRENT definition. Which forces the dirent from XPlatform library to be used instead of dirent.h in Linux.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
...s-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c-api/dirent.cc
Outdated
Show resolved
Hide resolved
...s-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c-api/dirent.cc
Show resolved
Hide resolved
...fs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c-api/dirent.h
Outdated
Show resolved
Hide resolved
* Moved the inclusion of dirent.h on non-Windows platforms to the top for easier understanding of c-api/dirent.h.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
* The method signatures in header files are already enclosed with extern "C" and thus, we don't need to wrap the implementation with extern "C".
This comment was marked as outdated.
This comment was marked as outdated.
...fs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c-api/dirent.h
Outdated
Show resolved
Hide resolved
* There were multiple #ifs and it was a bit cumbersome to understand. * Thus, I've simplified it into multiple header files. * core/dirent.h contains the core logic of dirent.h. * extern/dirent.h wraps it in an extern block. * c-api/dirent.h combines the two.
|
🎊 +1 overall
This message was automatically generated. |
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "x-platform/c-api/core/dirent.h" |
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.
At some point it is cleaner to do:
#if defined(WIN32) && defined(__cplusplus)
extern "C" {
#include "x-platform/c-api/core/dirent.h"
}
#else
#include "x-platform/c-api/core/dirent.h"
#endif
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've filed a JIRA to track this - https://issues.apache.org/jira/browse/HDFS-16630.
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
* jnihelper.c in HDFS native client uses dirent.h. This header file isn't available on Windows. * This PR provides a cross platform compatible implementation for dirent under the XPlatform library.
Description of PR
jnihelper.c in HDFS native client uses dirent.h. This header file isn't available on Windows. Thus, we need to replace this with a cross platform compatible implementation for dirent.
How was this patch tested?
In progress.
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?