Merge from coreutils.
[gnulib.git] / lib / mountlist.h
1 /* mountlist.h -- declarations for list of mounted file systems
2
3    Copyright (C) 1991, 1992, 1998, 2000, 2001, 2002, 2003, 2004 Free
4    Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software Foundation,
18    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19
20 #include <stdbool.h>
21
22 /* A mount table entry. */
23 struct mount_entry
24 {
25   char *me_devname;             /* Device node pathname, including "/dev/". */
26   char *me_mountdir;            /* Mount point directory pathname. */
27   char *me_type;                /* "nfs", "4.2", etc. */
28   dev_t me_dev;                 /* Device number of me_mountdir. */
29   unsigned int me_dummy : 1;    /* Nonzero for dummy file systems. */
30   unsigned int me_remote : 1;   /* Nonzero for remote fileystems. */
31   unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
32   struct mount_entry *me_next;
33 };
34
35 struct mount_entry *read_file_system_list (bool need_fs_type);
36
37 #ifndef ME_DUMMY
38 # define ME_DUMMY(Fs_name, Fs_type) \
39     (!strcmp (Fs_type, "autofs") \
40      /* for Irix 6.5 */ \
41      || !strcmp (Fs_type, "ignore"))
42 #endif
43
44 #undef STREQ
45 #define STREQ(a, b) (strcmp ((a), (b)) == 0)
46
47 #ifndef ME_REMOTE
48 /* A file system is `remote' if its Fs_name contains a `:'
49    or if (it is of type smbfs and its Fs_name starts with `//').  */
50 # define ME_REMOTE(Fs_name, Fs_type)    \
51     (strchr ((Fs_name), ':') != 0       \
52      || ((Fs_name)[0] == '/'            \
53          && (Fs_name)[1] == '/'         \
54          && STREQ (Fs_type, "smbfs")))
55 #endif