Whamcloud - gitweb
add fid_misc.c file with fid_to_le()
authornikita <nikita>
Sat, 15 Apr 2006 22:40:00 +0000 (22:40 +0000)
committernikita <nikita>
Sat, 15 Apr 2006 22:40:00 +0000 (22:40 +0000)
lustre/fid/Makefile.in
lustre/fid/fid_misc.c [new file with mode: 0644]
lustre/include/linux/lustre_fid.h

index b41f627..955d7b5 100644 (file)
@@ -1,4 +1,4 @@
 MODULES := fid
 MODULES := fid
-fid-objs := fid_seq.o
+fid-objs := fid_seq.o fid_misc.o
 
 @INCLUDE_RULES@
 
 @INCLUDE_RULES@
diff --git a/lustre/fid/fid_misc.c b/lustre/fid/fid_misc.c
new file mode 100644 (file)
index 0000000..5d3bfa6
--- /dev/null
@@ -0,0 +1,45 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  lustre/fid/fid_misc.c
+ *  Miscellaneous fid functions.
+ *
+ *  Copyright (c) 2006 Cluster File Systems, Inc.
+ *   Author: Nikita Danilov <nikita@clusterfs.com>
+ *
+ *   This file is part of the Lustre file system, http://www.lustre.org
+ *   Lustre is a trademark of Cluster File Systems, Inc.
+ *
+ *   You may have signed or agreed to another license before downloading
+ *   this software.  If so, you are bound by the terms and conditions
+ *   of that agreement, and the following does not apply to you.  See the
+ *   LICENSE file included with this distribution for more information.
+ *
+ *   If you did not agree to a different license, then this copy of Lustre
+ *   is open source software; you can redistribute it and/or modify it
+ *   under the terms of version 2 of the GNU General Public License as
+ *   published by the Free Software Foundation.
+ *
+ *   In either case, Lustre 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
+ *   license text for more details.
+ */
+
+#include <linux/module.h>
+
+#include <linux/obd.h>
+#include <linux/lustre_idl.h>
+#include <linux/lustre_fid.h>
+
+void fid_to_le(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 = le64_to_cpu(fid_seq(src));
+        dst->f_oid = le32_to_cpu(fid_oid(src));
+        dst->f_ver = le32_to_cpu(fid_ver(src));
+}
+EXPORT_SYMBOL(fid_to_le);
index 4c3a8da..b2893a4 100644 (file)
@@ -57,6 +57,7 @@ int seq_mgr_read(struct lu_context *, struct lu_seq_mgr *);
 int seq_mgr_write(struct lu_context *, struct lu_seq_mgr *);
 int seq_mgr_alloc(struct lu_context *, struct lu_seq_mgr *, __u64 *);
 
 int seq_mgr_write(struct lu_context *, struct lu_seq_mgr *);
 int seq_mgr_alloc(struct lu_context *, struct lu_seq_mgr *, __u64 *);
 
+struct lu_site;
 #if 0
 int fid_is_local(struct lu_site *site, const struct lu_fid *fid);
 #else
 #if 0
 int fid_is_local(struct lu_site *site, const struct lu_fid *fid);
 #else
@@ -66,4 +67,6 @@ static inline int fid_is_local(struct lu_site *site, const struct lu_fid *fid)
 }
 #endif
 
 }
 #endif
 
+void fid_to_le(struct lu_fid *dst, const struct lu_fid *src);
+
 #endif /* __LINUX_OBD_CLASS_H */
 #endif /* __LINUX_OBD_CLASS_H */