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 <liblustre.h>
30 #include <linux/obd_ost.h>
31 #include <linux/lustre_net.h>
33 void ost_pack_ioo(struct obd_ioobj *ioo, struct lov_stripe_md *lsm, int bufcnt)
35 ioo->ioo_id = HTON__u64(lsm->lsm_object_id);
36 ioo->ioo_gr = HTON__u64(0);
37 ioo->ioo_type = HTON__u32(S_IFREG);
38 ioo->ioo_bufcnt = HTON__u32(bufcnt);
41 void ost_unpack_ioo(struct obd_ioobj *dst, struct obd_ioobj *src)
43 dst->ioo_id = NTOH__u64(src->ioo_id);
44 dst->ioo_gr = NTOH__u64(src->ioo_gr);
45 dst->ioo_type = NTOH__u32(src->ioo_type);
46 dst->ioo_bufcnt = NTOH__u32(src->ioo_bufcnt);
49 void ost_pack_niobuf(struct niobuf_remote *nb, __u64 offset, __u32 len,
50 __u32 flags, __u32 xid)
52 nb->offset = HTON__u64(offset);
53 nb->len = HTON__u32(len);
54 nb->xid = HTON__u32(xid);
55 nb->flags = HTON__u32(flags);
58 void ost_unpack_niobuf(struct niobuf_remote *dst, struct niobuf_remote *src)
60 dst->offset = NTOH__u64(src->offset);
61 dst->len = NTOH__u32(src->len);
62 dst->xid = NTOH__u32(src->xid);
63 dst->flags = NTOH__u32(src->flags);