]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
kernel / libxfs sync-up
authorEric Sandeen <sandeen@sgi.com>
Thu, 3 Apr 2003 21:58:27 +0000 (21:58 +0000)
committerEric Sandeen <sandeen@sgi.com>
Thu, 3 Apr 2003 21:58:27 +0000 (21:58 +0000)
Implement get_unaligned / put_unaligned in libxfs
Change typecasts to a type available in kernel & userspace
Bump version

VERSION
doc/CHANGES
libxfs/xfs.h
libxfs/xfs_inode.c

diff --git a/VERSION b/VERSION
index 3d294f97afaee1c393cab82d5101666312522715..defdf955154fb82eb7bc09540c5f5e7629a244a9 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=4
-PKG_REVISION=4
+PKG_REVISION=5
 PKG_BUILD=0
index fc7d699796ea4f91ebed31abc437b3d6acd76b57..c962ba0deccfd7214ef871e060698fb00e323265 100644 (file)
@@ -1,3 +1,7 @@
+xfsprogs-2.4.5 (03 April 2003)
+       - Sync up xfs_inode.c in libxfs
+       - Implement get_unaligned/put_unaligned in libxfs
+
 xfsprogs-2.4.4 (30 March 2003)
        - Correct display of imaxpct in mkfs.xfs output.
        - Portability changes; including some code to support use
index 0059cf0bffb4be07e82531099a5045c82c147756..bb281f414db71258c9e447e84dea46451bd40915 100644 (file)
@@ -284,6 +284,15 @@ typedef struct { dev_t dev; } xfs_buftarg_t;
 #define XFS_TRANS_UNRESERVE_BLKQUOTA(mp,tp,ip,nblks)
 #define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl)
 
+/* These are lifted from the kernel */
+#define get_unaligned(ptr) \
+  ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
+
+#define put_unaligned(val, ptr)                        \
+  ({ __typeof__(*(ptr)) __tmp = (val);         \
+     memmove((ptr), &__tmp, sizeof(*(ptr)));   \
+     (void)0; })
+
 #if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 95))
 # define xfs_fs_cmn_err(a,b,msg,args...)( fprintf(stderr, msg, ## args) )
 # define cmn_err(a,msg,args...)                ( fprintf(stderr, msg, ## args) )
index 1549451dc4bcfc15606c03184c0aad5c7ca508f2..adc4b557ed9dd2a192439c1808e9a7383be6e86a 100644 (file)
@@ -477,8 +477,10 @@ xfs_iformat_extents(
                ep = ifp->if_u1.if_extents;
 #if ARCH_CONVERT != ARCH_NOCONVERT
                for (i = 0; i < nex; i++, ep++, dp++) {
-                       ep->l0 = INT_GET(dp->l0, ARCH_CONVERT);
-                       ep->l1 = INT_GET(dp->l1, ARCH_CONVERT);
+                       ep->l0 = INT_GET(get_unaligned((__uint64_t*)&dp->l0),
+                                                               ARCH_CONVERT);
+                       ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1),
+                                                               ARCH_CONVERT);
                }
 #else
                memcpy(ep, dp, size);
@@ -1312,8 +1314,10 @@ xfs_iextents_copy(
 
 #if ARCH_CONVERT != ARCH_NOCONVERT
                /* Translate to on disk format */
-               dest_ep->l0 = INT_GET(ep->l0, ARCH_CONVERT);
-               dest_ep->l1 = INT_GET(ep->l1, ARCH_CONVERT);
+               put_unaligned(INT_GET(ep->l0, ARCH_CONVERT),
+                             (__uint64_t*)&dest_ep->l0);
+               put_unaligned(INT_GET(ep->l1, ARCH_CONVERT),
+                             (__uint64_t*)&dest_ep->l1);
 #else
                *dest_ep = *ep;
 #endif