Fix the creation of the dumpdir directory in stress_floppy Makefile
[ltp-debian.git] / lib / tst_is_cwd.c
blobad6b747f025659d27b70b22963f57d596ae0d80b
1 /*
2 * Michal Simek <monstr@monstr.eu>, 2009-08-03 - ramfs
3 * Kumar Gala <galak@kernel.crashing.org>, 2007-11-14 - nfs
4 * Ricky Ng-Adam <rngadam@yahoo.com>, 2005-01-01 - tmpfs
6 * DESCRIPTION
7 * Check if current directory is on a tmpfs/nfs/ramfs filesystem
8 * If current directory is tmpfs/nfs/ramfs, return 1
9 * If current directory is NOT tmpfs/nfs/ramfs, return 0
12 #include <sys/vfs.h>
14 #define TMPFS_MAGIC 0x01021994 /* man 2 statfs */
15 int tst_is_cwd_tmpfs(void)
17 struct statfs sf;
18 statfs(".", &sf);
20 /* Verify that the file is not on a tmpfs (in-memory) filesystem */
21 return sf.f_type == TMPFS_MAGIC ? 1 : 0;
24 #define NFS_MAGIC 0x6969 /* man 2 statfs */
25 int tst_is_cwd_nfs(void)
27 struct statfs sf;
28 statfs(".", &sf);
30 /* Verify that the file is not on a nfs filesystem */
31 return sf.f_type == NFS_MAGIC ? 1 : 0;
34 #define RAMFS_MAGIC 0x858458f6
35 int tst_is_cwd_ramfs(void)
37 struct statfs sf;
38 statfs(".", &sf);
40 /* Verify that the file is not on a ramfs (in-memory) filesystem */
41 return sf.f_type == RAMFS_MAGIC ? 1 : 0;