Whamcloud - gitweb
876d41c1ba013177e7cd34d2635c8b1f3844c5a7
[fs/lustre-release.git] / lustre / obdclass / statfs_pack.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2002 Cluster File Systems, Inc. <adilger@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
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.
11  *
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.
16  *
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.
20  *
21  * (Un)packing of OST/MDS requests
22  *
23  */
24
25 #define DEBUG_SUBSYSTEM S_CLASS
26
27 #define EXPORT_SYMTAB
28 #include <linux/lustre_net.h>
29 #include <linux/obd_support.h>
30
31 void obd_statfs_pack(struct obd_statfs *tgt, struct obd_statfs *src)
32 {
33         tgt->os_type = HTON__u64(src->os_type);
34         tgt->os_blocks = HTON__u64(src->os_blocks);
35         tgt->os_bfree = HTON__u64(src->os_bfree);
36         tgt->os_bavail = HTON__u64(src->os_bavail);
37         tgt->os_files = HTON__u64(src->os_files);
38         tgt->os_ffree = HTON__u64(src->os_ffree);
39         tgt->os_bsize = HTON__u32(src->os_bsize);
40         tgt->os_namelen = HTON__u32(src->os_namelen);
41 }
42
43 void obd_statfs_unpack(struct obd_statfs *tgt, struct obd_statfs *src)
44 {
45         obd_statfs_pack(tgt, src);
46 }
47
48 void statfs_pack(struct obd_statfs *osfs, struct statfs *sfs)
49 {
50         osfs->os_type = sfs->f_type;
51         osfs->os_blocks = sfs->f_blocks;
52         osfs->os_bfree = sfs->f_bfree;
53         osfs->os_bavail = sfs->f_bavail;
54         osfs->os_files = sfs->f_files;
55         osfs->os_ffree = sfs->f_ffree;
56         osfs->os_bsize = sfs->f_bsize;
57         osfs->os_namelen = sfs->f_namelen;
58 }
59
60 void statfs_unpack(struct statfs *sfs, struct obd_statfs *osfs)
61 {
62         sfs->f_type = osfs->os_type;
63         sfs->f_blocks = osfs->os_blocks;
64         sfs->f_bfree = osfs->os_bfree;
65         sfs->f_bavail = osfs->os_bavail;
66         sfs->f_files = osfs->os_files;
67         sfs->f_ffree = osfs->os_ffree;
68         sfs->f_bsize = osfs->os_bsize;
69         sfs->f_namelen = osfs->os_namelen;
70 }
71
72 EXPORT_SYMBOL(obd_statfs_pack);
73 EXPORT_SYMBOL(obd_statfs_unpack);
74 EXPORT_SYMBOL(statfs_pack);
75 EXPORT_SYMBOL(statfs_unpack);