Whamcloud - gitweb
- some be_cpu, etc., convetions.
authoryury <yury>
Thu, 7 Sep 2006 15:53:33 +0000 (15:53 +0000)
committeryury <yury>
Thu, 7 Sep 2006 15:53:33 +0000 (15:53 +0000)
lustre/fid/fid_lib.c
lustre/include/lustre_fid.h

index a979299..a87bff0 100644 (file)
@@ -66,6 +66,32 @@ void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 }
 EXPORT_SYMBOL(fid_le_to_cpu);
 
+#ifdef __KERNEL__
+void fid_cpu_to_be(struct lu_fid *dst, const struct lu_fid *src)
+{
+        /* check that all fields are converted */
+        CLASSERT(sizeof *src ==
+                 sizeof fid_seq(src) +
+                 sizeof fid_oid(src) + sizeof fid_ver(src));
+        dst->f_seq = cpu_to_be64(fid_seq(src));
+        dst->f_oid = cpu_to_be32(fid_oid(src));
+        dst->f_ver = cpu_to_be32(fid_ver(src));
+}
+EXPORT_SYMBOL(fid_cpu_to_be);
+
+void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
+{
+        /* check that all fields are converted */
+        CLASSERT(sizeof *src ==
+                 sizeof fid_seq(src) +
+                 sizeof fid_oid(src) + sizeof fid_ver(src));
+        dst->f_seq = be64_to_cpu(fid_seq(src));
+        dst->f_oid = be32_to_cpu(fid_oid(src));
+        dst->f_ver = be32_to_cpu(fid_ver(src));
+}
+EXPORT_SYMBOL(fid_be_to_cpu);
+#endif
+
 void range_cpu_to_le(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
@@ -87,3 +113,27 @@ void range_le_to_cpu(struct lu_range *dst, const struct lu_range *src)
         dst->lr_end = le64_to_cpu(src->lr_end);
 }
 EXPORT_SYMBOL(range_le_to_cpu);
+
+#ifdef __KERNEL__
+void range_cpu_to_be(struct lu_range *dst, const struct lu_range *src)
+{
+        /* check that all fields are converted */
+        CLASSERT(sizeof *src ==
+                 sizeof src->lr_start +
+                 sizeof src->lr_end);
+        dst->lr_start = cpu_to_be64(src->lr_start);
+        dst->lr_end = cpu_to_be64(src->lr_end);
+}
+EXPORT_SYMBOL(range_cpu_to_be);
+
+void range_be_to_cpu(struct lu_range *dst, const struct lu_range *src)
+{
+        /* check that all fields are converted */
+        CLASSERT(sizeof *src ==
+                 sizeof src->lr_start +
+                 sizeof src->lr_end);
+        dst->lr_start = be64_to_cpu(src->lr_start);
+        dst->lr_end = be64_to_cpu(src->lr_end);
+}
+EXPORT_SYMBOL(range_be_to_cpu);
+#endif
index 730b44a..d9d46a5 100644 (file)
@@ -184,10 +184,14 @@ int seq_client_alloc_fid(struct lu_client_seq *seq,
 int fid_is_local(struct lu_site *site, const struct lu_fid *fid);
 
 void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src);
+void fid_cpu_to_be(struct lu_fid *dst, const struct lu_fid *src);
 void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src);
+void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src);
 
 /* Range common stuff */
 void range_cpu_to_le(struct lu_range *dst, const struct lu_range *src);
+void range_cpu_to_be(struct lu_range *dst, const struct lu_range *src);
 void range_le_to_cpu(struct lu_range *dst, const struct lu_range *src);
+void range_be_to_cpu(struct lu_range *dst, const struct lu_range *src);
 
 #endif /* __LINUX_OBD_CLASS_H */