You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ga...@apache.org on 2022/07/08 03:59:33 UTC
[hadoop] branch trunk updated: HDFS-16466. Implement Linux permission flags on Windows (#4526)
This is an automated email from the ASF dual-hosted git repository.
gaurava pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 8e39e35bea2 HDFS-16466. Implement Linux permission flags on Windows (#4526)
8e39e35bea2 is described below
commit 8e39e35bea215bf160f0895aa3868928fb106f28
Author: Gautham B A <ga...@gmail.com>
AuthorDate: Fri Jul 8 09:29:13 2022 +0530
HDFS-16466. Implement Linux permission flags on Windows (#4526)
* HDFS-16466. Implement Linux permission flags on Windows
* statinfo.cc uses POSIX permission flags.
These flags aren't available for Windows.
* This PR implements the equivalent flags
on Windows to make this cross platform
compatible.
---
.../main/native/libhdfspp/lib/common/statinfo.cc | 4 ++-
.../main/native/libhdfspp/lib/x-platform/stat.h | 42 ++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/statinfo.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/statinfo.cc
index 2fb744fbdde..072a3f36584 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/statinfo.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/statinfo.cc
@@ -17,10 +17,12 @@
*/
#include <hdfspp/statinfo.h>
-#include <sys/stat.h>
+
#include <sstream>
#include <iomanip>
+#include "x-platform/stat.h"
+
namespace hdfs {
StatInfo::StatInfo()
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/stat.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/stat.h
new file mode 100644
index 00000000000..c078d44a518
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/stat.h
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_STAT
+#define NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_STAT
+
+#include <sys/stat.h>
+
+#if defined(_WIN32)
+
+// Windows defines the macros for user RWX (_S_IREAD, _S_IWRITE and _S_IEXEC),
+// but not for group and others. We implement the permissions for group and
+// others through appropriate bit shifting.
+
+#define S_IRUSR _S_IREAD
+#define S_IWUSR _S_IWRITE
+#define S_IXUSR _S_IEXEC
+#define S_IRGRP (S_IRUSR >> 3)
+#define S_IWGRP (S_IWUSR >> 3)
+#define S_IXGRP (S_IXUSR >> 3)
+#define S_IROTH (S_IRGRP >> 3)
+#define S_IWOTH (S_IWGRP >> 3)
+#define S_IXOTH (S_IXGRP >> 3)
+
+#endif
+
+#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org