1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@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 requests
25 #define DEBUG_SUBSYSTEM S_OST
27 #include <linux/obd_ost.h>
28 #include <linux/lustre_net.h>
30 void ost_pack_ioo(void **tmp, struct lov_stripe_md *md, int bufcnt)
32 struct obd_ioobj *ioo = *tmp;
35 ioo->ioo_id = HTON__u64(md->lmd_object_id);
36 ioo->ioo_gr = HTON__u64(0);
37 ioo->ioo_type = HTON__u32(S_IFREG);
38 ioo->ioo_bufcnt = HTON__u32(bufcnt);
39 *tmp = c + sizeof(*ioo);
42 void ost_unpack_ioo(void **tmp, struct obd_ioobj **ioop)
45 struct obd_ioobj *ioo = *tmp;
48 ioo->ioo_id = NTOH__u64(ioo->ioo_id);
49 ioo->ioo_gr = NTOH__u64(ioo->ioo_gr);
50 ioo->ioo_type = NTOH__u32(ioo->ioo_type);
51 ioo->ioo_bufcnt = NTOH__u32(ioo->ioo_bufcnt);
52 *tmp = c + sizeof(*ioo);
55 void ost_pack_niobuf(void **tmp, __u64 offset, __u32 len, __u32 flags,
58 struct niobuf_remote *nb = *tmp;
61 nb->offset = HTON__u64(offset);
62 nb->len = HTON__u32(len);
63 nb->flags = HTON__u32(flags);
64 nb->xid = HTON__u32(xid);
65 *tmp = c + sizeof(*nb);
68 void ost_unpack_niobuf(void **tmp, struct niobuf_remote **nbp)
71 struct niobuf_remote *nb = *tmp;
75 nb->offset = NTOH__u64(nb->offset);
76 nb->len = NTOH__u32(nb->len);
77 nb->flags = NTOH__u32(nb->flags);
79 *tmp = c + sizeof(*nb);