acl-devel
[Top][All Lists]
Advanced

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

[Acl-devel] [PATCH] acl: remove byteorder.h prefer <endian.h> instead


From: Cristian Rodríguez
Subject: [Acl-devel] [PATCH] acl: remove byteorder.h prefer <endian.h> instead
Date: Mon, 14 Dec 2015 00:57:35 -0300

---
 libacl/Makemodule.am         |  1 -
 libacl/__acl_extended_file.c |  1 -
 libacl/__acl_from_xattr.c    | 10 +++++-----
 libacl/__acl_to_xattr.c      | 10 +++++-----
 libacl/acl_copy_ext.c        |  6 +++---
 libacl/acl_delete_def_file.c |  1 -
 libacl/acl_extended_fd.c     |  1 -
 libacl/acl_get_fd.c          |  1 -
 libacl/acl_get_file.c        |  1 -
 libacl/acl_set_fd.c          |  1 -
 libacl/acl_set_file.c        |  1 -
 libacl/byteorder.h           | 37 -------------------------------------
 12 files changed, 13 insertions(+), 58 deletions(-)
 delete mode 100644 libacl/byteorder.h

diff --git a/libacl/Makemodule.am b/libacl/Makemodule.am
index c35214c..d17f5ea 100644
--- a/libacl/Makemodule.am
+++ b/libacl/Makemodule.am
@@ -14,7 +14,6 @@ CFILES = $(POSIX_CFILES) $(LIBACL_CFILES) $(INTERNAL_CFILES) \
 HFILES = \
        libacl/libobj.h \
        libacl/libacl.h \
-       libacl/byteorder.h \
        libacl/__acl_from_xattr.h \
        libacl/__acl_to_xattr.h \
        libacl/perm_copy.h \
diff --git a/libacl/__acl_extended_file.c b/libacl/__acl_extended_file.c
index c81dc8f..ad16a1f 100644
--- a/libacl/__acl_extended_file.c
+++ b/libacl/__acl_extended_file.c
@@ -23,7 +23,6 @@
 #include <sys/xattr.h>
 #include "libacl.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 #include "__acl_extended_file.h"
 
diff --git a/libacl/__acl_from_xattr.c b/libacl/__acl_from_xattr.c
index 34f14a0..ddc3d42 100644
--- a/libacl/__acl_from_xattr.c
+++ b/libacl/__acl_from_xattr.c
@@ -19,9 +19,9 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#include <endian.h>
 #include "libacl.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 
@@ -39,7 +39,7 @@ __acl_from_xattr(const char *ext_acl_p, size_t size)
                errno = EINVAL;
                return NULL;
        }
-       if (ext_header_p->a_version != cpu_to_le32(ACL_EA_VERSION)) {
+       if (ext_header_p->a_version != htole32(ACL_EA_VERSION)) {
                errno = EINVAL;
                return NULL;
        }
@@ -59,8 +59,8 @@ __acl_from_xattr(const char *ext_acl_p, size_t size)
                if (!entry_obj_p)
                        goto fail;
 
-               entry_obj_p->etag        = le16_to_cpu(ext_entry_p->e_tag);
-               entry_obj_p->eperm.sperm = le16_to_cpu(ext_entry_p->e_perm);
+               entry_obj_p->etag        = le16toh(ext_entry_p->e_tag);
+               entry_obj_p->eperm.sperm = le16toh(ext_entry_p->e_perm);
 
                switch(entry_obj_p->etag) {
                        case ACL_USER_OBJ:
@@ -73,7 +73,7 @@ __acl_from_xattr(const char *ext_acl_p, size_t size)
                        case ACL_USER:
                        case ACL_GROUP:
                                entry_obj_p->eid.qid =
-                                       le32_to_cpu(ext_entry_p->e_id);
+                                       le32toh(ext_entry_p->e_id);
                                break;
 
                        default:
diff --git a/libacl/__acl_to_xattr.c b/libacl/__acl_to_xattr.c
index afd8116..ccf891d 100644
--- a/libacl/__acl_to_xattr.c
+++ b/libacl/__acl_to_xattr.c
@@ -19,11 +19,11 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#include <endian.h>
 #include <errno.h>
 #include <sys/acl.h>
 #include "libacl.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 
@@ -39,17 +39,17 @@ __acl_to_xattr(const acl_obj *acl_obj_p, size_t *size)
        if (!ext_header_p)
                return NULL;
 
-       ext_header_p->a_version = cpu_to_le32(ACL_EA_VERSION);
+       ext_header_p->a_version = htole32(ACL_EA_VERSION);
        ext_ent_p = (acl_ea_entry *)(ext_header_p+1);
        FOREACH_ACL_ENTRY(entry_obj_p, acl_obj_p) {
-               ext_ent_p->e_tag   = cpu_to_le16(entry_obj_p->etag);
-               ext_ent_p->e_perm  = cpu_to_le16(entry_obj_p->eperm.sperm);
+               ext_ent_p->e_tag   = htole16(entry_obj_p->etag);
+               ext_ent_p->e_perm  = htole16(entry_obj_p->eperm.sperm);
 
                switch(entry_obj_p->etag) {
                        case ACL_USER:
                        case ACL_GROUP:
                                ext_ent_p->e_id =
-                                       cpu_to_le32(entry_obj_p->eid.qid);
+                                       htole32(entry_obj_p->eid.qid);
                                break;
 
                        default:
diff --git a/libacl/acl_copy_ext.c b/libacl/acl_copy_ext.c
index 7f51185..5d07a0a 100644
--- a/libacl/acl_copy_ext.c
+++ b/libacl/acl_copy_ext.c
@@ -42,9 +42,9 @@ acl_copy_ext(void *buf_p, acl_t acl, ssize_t size)
        }
        acl_ext->x_size = size_required;
        FOREACH_ACL_ENTRY(entry_obj_p, acl_obj_p) {
-               //ent_p->e_tag  = cpu_to_le16(entry_obj_p->etag);
-               //ent_p->e_perm = cpu_to_le16(entry_obj_p->eperm.sperm);
-               //ent_p->e_id   = cpu_to_le32(entry_obj_p->eid.quid);
+               //ent_p->e_tag  = htole16(entry_obj_p->etag);
+               //ent_p->e_perm = htole16(entry_obj_p->eperm.sperm);
+               //ent_p->e_id   = htole32(entry_obj_p->eid.quid);
                *ent_p++ = entry_obj_p->eentry;
        }
        return 0;
diff --git a/libacl/acl_delete_def_file.c b/libacl/acl_delete_def_file.c
index 845940c..967757a 100644
--- a/libacl/acl_delete_def_file.c
+++ b/libacl/acl_delete_def_file.c
@@ -21,7 +21,6 @@
 
 #include <sys/types.h>
 #include <sys/xattr.h>
-#include "byteorder.h"
 #include "acl_ea.h"
 #include "config.h"
 #include "libacl.h"
diff --git a/libacl/acl_extended_fd.c b/libacl/acl_extended_fd.c
index bbf9055..88eec61 100644
--- a/libacl/acl_extended_fd.c
+++ b/libacl/acl_extended_fd.c
@@ -23,7 +23,6 @@
 #include <sys/xattr.h>
 #include "libacl.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 int
diff --git a/libacl/acl_get_fd.c b/libacl/acl_get_fd.c
index 15e3880..ab67088 100644
--- a/libacl/acl_get_fd.c
+++ b/libacl/acl_get_fd.c
@@ -28,7 +28,6 @@
 #include "libacl.h"
 #include "__acl_from_xattr.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 /* 23.4.15 */
diff --git a/libacl/acl_get_file.c b/libacl/acl_get_file.c
index d3131bc..08827f8 100644
--- a/libacl/acl_get_file.c
+++ b/libacl/acl_get_file.c
@@ -28,7 +28,6 @@
 #include "libacl.h"
 #include "__acl_from_xattr.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 /* 23.4.16 */
diff --git a/libacl/acl_set_fd.c b/libacl/acl_set_fd.c
index 38dcd4a..6fa5d5c 100644
--- a/libacl/acl_set_fd.c
+++ b/libacl/acl_set_fd.c
@@ -24,7 +24,6 @@
 #include "libacl.h"
 #include "__acl_to_xattr.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 
diff --git a/libacl/acl_set_file.c b/libacl/acl_set_file.c
index c234b4a..13c0a00 100644
--- a/libacl/acl_set_file.c
+++ b/libacl/acl_set_file.c
@@ -26,7 +26,6 @@
 #include "libacl.h"
 #include "__acl_to_xattr.h"
 
-#include "byteorder.h"
 #include "acl_ea.h"
 
 
diff --git a/libacl/byteorder.h b/libacl/byteorder.h
deleted file mode 100644
index 05f5d87..0000000
--- a/libacl/byteorder.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-  Copyright (C) 2000, 2002  Andreas Gruenbacher <address@hidden>
-
-  This program is free software: you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation, either version 2.1 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <endian.h>
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-# define cpu_to_le16(w16) le16_to_cpu(w16)
-# define le16_to_cpu(w16) ((u_int16_t)((u_int16_t)(w16) >> 8) | \
-                           (u_int16_t)((u_int16_t)(w16) << 8))
-# define cpu_to_le32(w32) le32_to_cpu(w32)
-# define le32_to_cpu(w32) ((u_int32_t)( (u_int32_t)(w32) >>24) | \
-                           (u_int32_t)(((u_int32_t)(w32) >> 8) & 0xFF00) | \
-                           (u_int32_t)(((u_int32_t)(w32) << 8) & 0xFF0000) | \
-                          (u_int32_t)( (u_int32_t)(w32) <<24))
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-# define cpu_to_le16(w16) ((u_int16_t)(w16))
-# define le16_to_cpu(w16) ((u_int16_t)(w16))
-# define cpu_to_le32(w32) ((u_int32_t)(w32))
-# define le32_to_cpu(w32) ((u_int32_t)(w32))
-#else
-# error unknown endianess?
-#endif
-
-- 
2.6.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]