From: Michal Simek <[email protected]> I added support for testing ramfs and add together tests for nfs, tmpfs and ramfs.
Signed-off-by: Michal Simek <[email protected]> --- lib/tst_is_cwd.c | 42 ++++++++++++++++++++++++++++++++++++++++++ lib/tst_is_cwd_nfs.c | 41 ----------------------------------------- lib/tst_is_cwd_tmpfs.c | 24 ------------------------ 3 files changed, 42 insertions(+), 65 deletions(-) create mode 100644 lib/tst_is_cwd.c delete mode 100644 lib/tst_is_cwd_nfs.c delete mode 100644 lib/tst_is_cwd_tmpfs.c diff --git a/lib/tst_is_cwd.c b/lib/tst_is_cwd.c new file mode 100644 index 0000000..ad6b747 --- /dev/null +++ b/lib/tst_is_cwd.c @@ -0,0 +1,42 @@ +/* + * Michal Simek <[email protected]>, 2009-08-03 - ramfs + * Kumar Gala <[email protected]>, 2007-11-14 - nfs + * Ricky Ng-Adam <[email protected]>, 2005-01-01 - tmpfs + * + * DESCRIPTION + * Check if current directory is on a tmpfs/nfs/ramfs filesystem + * If current directory is tmpfs/nfs/ramfs, return 1 + * If current directory is NOT tmpfs/nfs/ramfs, return 0 + */ + +#include <sys/vfs.h> + +#define TMPFS_MAGIC 0x01021994 /* man 2 statfs */ +int tst_is_cwd_tmpfs(void) +{ + struct statfs sf; + statfs(".", &sf); + + /* Verify that the file is not on a tmpfs (in-memory) filesystem */ + return sf.f_type == TMPFS_MAGIC ? 1 : 0; +} + +#define NFS_MAGIC 0x6969 /* man 2 statfs */ +int tst_is_cwd_nfs(void) +{ + struct statfs sf; + statfs(".", &sf); + + /* Verify that the file is not on a nfs filesystem */ + return sf.f_type == NFS_MAGIC ? 1 : 0; +} + +#define RAMFS_MAGIC 0x858458f6 +int tst_is_cwd_ramfs(void) +{ + struct statfs sf; + statfs(".", &sf); + + /* Verify that the file is not on a ramfs (in-memory) filesystem */ + return sf.f_type == RAMFS_MAGIC ? 1 : 0; +} diff --git a/lib/tst_is_cwd_nfs.c b/lib/tst_is_cwd_nfs.c deleted file mode 100644 index 130c6c2..0000000 --- a/lib/tst_is_cwd_nfs.c +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************/ -/* This program is free software; you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation; either version 2 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ -/* the GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program; if not, write to the Free Software */ -/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/******************************************************************************/ -/* - * AUTHOR - * Kumar Gala <[email protected]>, 2007-11-14 - * based on tst_is_cwd_tmpfs() - * - * DESCRIPTION - * Check if current directory is on a nfs filesystem - * If current directory is nfs, return 1 - * If current directory is NOT nfs, return 0 - * - * - */ -/******************************************************************************/ - -#include <sys/vfs.h> - -#define NFS_MAGIC 0x6969 /* man 2 statfs */ - -int tst_is_cwd_nfs(void) -{ - struct statfs sf; - statfs(".", &sf); - - /* Verify that the file is not on a nfs filesystem */ - return sf.f_type == NFS_MAGIC?1:0; -} diff --git a/lib/tst_is_cwd_tmpfs.c b/lib/tst_is_cwd_tmpfs.c deleted file mode 100644 index 61c5c39..0000000 --- a/lib/tst_is_cwd_tmpfs.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * AUTHOR - * Ricky Ng-Adam <[email protected]>, 2005-01-01 - * - * DESCRIPTION - * Check if current directory is on a tmpfs filesystem - * If current directory is tmpfs, return 1 - * If current directory is NOT tmpfs, return 0 - * - * - */ - -#include <sys/vfs.h> - -#define TMPFS_MAGIC 0x01021994 /* man 2 statfs */ - -int tst_is_cwd_tmpfs(void) -{ - struct statfs sf; - statfs(".", &sf); - - /* Verify that the file is not on a tmpfs (in-memory) filesystem */ - return sf.f_type == TMPFS_MAGIC?1:0; -} -- 1.5.5.1 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
