Whamcloud - gitweb
b=23072 avoid duplicate cfs_size_round declarations
authorAndreas Dilger <andreas.dilger@oracle.com>
Tue, 14 Dec 2010 06:54:49 +0000 (23:54 -0700)
committerVitaly Fertman <vitaly.fertman@oracle.com>
Fri, 17 Dec 2010 01:21:50 +0000 (04:21 +0300)
Use HAVE_CFS_SIZE_ROUND to determine if libcfs_private.h or lustre_user.h has
declared the cfs_size_round() helper function.  This avoids conflicts if both
of these headers are included in different orders.

libcfs/include/libcfs/libcfs_private.h
lustre/include/lustre/lustre_user.h

index 92f9854..9e33e26 100644 (file)
@@ -469,10 +469,13 @@ static inline int cfs_size_round4 (int val)
         return (val + 3) & (~0x3);
 }
 
         return (val + 3) & (~0x3);
 }
 
+#ifndef HAVE_CFS_SIZE_ROUND
 static inline int cfs_size_round (int val)
 {
         return (val + 7) & (~0x7);
 }
 static inline int cfs_size_round (int val)
 {
         return (val + 7) & (~0x7);
 }
+#define HAVE_CFS_SIZE_ROUND
+#endif
 
 static inline int cfs_size_round16(int val)
 {
 
 static inline int cfs_size_round16(int val)
 {
index 4ea95a9..14dff87 100644 (file)
@@ -828,22 +828,30 @@ struct hsm_action_list {
            boundaries. See hai_zero */
 } __attribute__((packed));
 
            boundaries. See hai_zero */
 } __attribute__((packed));
 
+#ifndef HAVE_CFS_SIZE_ROUND
+static inline int cfs_size_round (int val)
+{
+        return (val + 7) & (~0x7);
+}
+#define HAVE_CFS_SIZE_ROUND
+#endif
+
 /* Return pointer to first hai in action list */
 /* Return pointer to first hai in action list */
-static __inline__ struct hsm_action_item * hai_zero(struct hsm_action_list *hal)
+static inline struct hsm_action_item * hai_zero(struct hsm_action_list *hal)
 {
         return (struct hsm_action_item *)(hal->hal_fsname +
                                           cfs_size_round(strlen(hal-> \
                                                                 hal_fsname)));
 }
 /* Return pointer to next hai */
 {
         return (struct hsm_action_item *)(hal->hal_fsname +
                                           cfs_size_round(strlen(hal-> \
                                                                 hal_fsname)));
 }
 /* Return pointer to next hai */
-static __inline__ struct hsm_action_item * hai_next(struct hsm_action_item *hai)
+static inline struct hsm_action_item * hai_next(struct hsm_action_item *hai)
 {
         return (struct hsm_action_item *)((char *)hai +
                                           cfs_size_round(hai->hai_len));
 }
 
 /* Return size of an hsm_action_list */
 {
         return (struct hsm_action_item *)((char *)hai +
                                           cfs_size_round(hai->hai_len));
 }
 
 /* Return size of an hsm_action_list */
-static __inline__ int hal_size(struct hsm_action_list *hal)
+static inline int hal_size(struct hsm_action_list *hal)
 {
         int i, sz;
         struct hsm_action_item *hai;
 {
         int i, sz;
         struct hsm_action_item *hai;