1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc. <adilger@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * (Un)packing of OST/MDS requests
25 #define DEBUG_SUBSYSTEM S_LLITE
27 #include <linux/lustre_net.h>
28 #include <linux/obd_support.h>
30 void lov_packdesc(struct lov_desc *ld)
32 ld->ld_tgt_count = HTON__u32(ld->ld_tgt_count);
33 ld->ld_default_stripe_count = HTON__u32(ld->ld_default_stripe_count);
34 ld->ld_default_stripe_size = HTON__u32(ld->ld_default_stripe_size);
35 ld->ld_pattern = HTON__u32(ld->ld_pattern);
38 void lov_unpackdesc(struct lov_desc *ld)
40 ld->ld_tgt_count = NTOH__u32(ld->ld_tgt_count);
41 ld->ld_default_stripe_count = HTON__u32(ld->ld_default_stripe_count);
42 ld->ld_default_stripe_size = HTON__u32(ld->ld_default_stripe_size);
43 ld->ld_pattern = HTON__u32(ld->ld_pattern);
46 void lov_packmd(struct lov_mds_md *mdsmd, struct lov_stripe_md *md)
49 mdsmd->lmd_magic = md->lmd_magic;
50 mdsmd->lmd_easize = md->lmd_easize;
51 mdsmd->lmd_object_id = md->lmd_object_id;
52 mdsmd->lmd_stripe_offset = md->lmd_stripe_offset;
53 mdsmd->lmd_stripe_count = md->lmd_stripe_count;
54 mdsmd->lmd_stripe_size = md->lmd_stripe_size;
55 mdsmd->lmd_stripe_pattern = md->lmd_stripe_pattern;
57 for (i=0; i<md->lmd_stripe_count; i++)
58 mdsmd->lmd_objects[i].l_object_id = md->lmd_oinfo[i].loi_id;
61 void lov_unpackmd(struct lov_stripe_md *md, struct lov_mds_md *mdsmd)
64 md->lmd_magic = mdsmd->lmd_magic;
65 md->lmd_easize = mdsmd->lmd_easize;
66 md->lmd_object_id = mdsmd->lmd_object_id;
67 md->lmd_stripe_offset = mdsmd->lmd_stripe_offset;
68 md->lmd_stripe_count = mdsmd->lmd_stripe_count;
69 md->lmd_stripe_size = mdsmd->lmd_stripe_size;
70 md->lmd_stripe_pattern = mdsmd->lmd_stripe_pattern;
72 for (i=0; i<md->lmd_stripe_count; i++) {
73 md->lmd_oinfo[i].loi_id = mdsmd->lmd_objects[i].l_object_id;
74 md->lmd_oinfo[i].loi_size = 0;