1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002, 2003 Cluster File Systems, Inc.
5 * Author: Andreas Dilger <adilger@clusterfs.com>
7 * This file is part of Lustre, http://www.lustre.org.
9 * Lustre is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU General Public
11 * License as published by the Free Software Foundation.
13 * Lustre is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Lustre; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * (Un)packing of OST/MDS requests
26 #define DEBUG_SUBSYSTEM S_CLASS
29 # define EXPORT_SYMTAB
32 #include <liblustre.h>
34 #include <linux/version.h>
35 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
36 #include <linux/statfs.h>
40 #include <linux/lustre_export.h>
41 #include <linux/lustre_net.h>
42 #include <linux/obd_support.h>
43 #include <linux/obd_class.h>
45 void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs)
47 memset(osfs, 0, sizeof(*osfs));
48 osfs->os_type = sfs->f_type;
49 osfs->os_blocks = sfs->f_blocks;
50 osfs->os_bfree = sfs->f_bfree;
51 osfs->os_bavail = sfs->f_bavail;
52 osfs->os_files = sfs->f_files;
53 osfs->os_ffree = sfs->f_ffree;
54 osfs->os_bsize = sfs->f_bsize;
55 osfs->os_namelen = sfs->f_namelen;
58 void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs)
60 memset(sfs, 0, sizeof(*sfs));
61 sfs->f_type = osfs->os_type;
62 sfs->f_blocks = osfs->os_blocks;
63 sfs->f_bfree = osfs->os_bfree;
64 sfs->f_bavail = osfs->os_bavail;
65 sfs->f_files = osfs->os_files;
66 sfs->f_ffree = osfs->os_ffree;
67 sfs->f_bsize = osfs->os_bsize;
68 sfs->f_namelen = osfs->os_namelen;
71 EXPORT_SYMBOL(statfs_pack);
72 EXPORT_SYMBOL(statfs_unpack);