From 08b089cf59883f952b110f5c9e5c2aea7ba716f9 Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 15 Apr 2006 22:40:00 +0000 Subject: [PATCH] add fid_misc.c file with fid_to_le() --- lustre/fid/Makefile.in | 2 +- lustre/fid/fid_misc.c | 45 +++++++++++++++++++++++++++++++++++++++ lustre/include/linux/lustre_fid.h | 3 +++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 lustre/fid/fid_misc.c diff --git a/lustre/fid/Makefile.in b/lustre/fid/Makefile.in index b41f627..955d7b5 100644 --- a/lustre/fid/Makefile.in +++ b/lustre/fid/Makefile.in @@ -1,4 +1,4 @@ MODULES := fid -fid-objs := fid_seq.o +fid-objs := fid_seq.o fid_misc.o @INCLUDE_RULES@ diff --git a/lustre/fid/fid_misc.c b/lustre/fid/fid_misc.c new file mode 100644 index 0000000..5d3bfa6 --- /dev/null +++ b/lustre/fid/fid_misc.c @@ -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 + * + * 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 + +#include +#include +#include + +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); diff --git a/lustre/include/linux/lustre_fid.h b/lustre/include/linux/lustre_fid.h index 4c3a8da..b2893a4 100644 --- a/lustre/include/linux/lustre_fid.h +++ b/lustre/include/linux/lustre_fid.h @@ -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 *); +struct lu_site; #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 +void fid_to_le(struct lu_fid *dst, const struct lu_fid *src); + #endif /* __LINUX_OBD_CLASS_H */ -- 1.8.3.1