blob: d28b6adaff242eb5036e147baf90e8a348445c62 [file] [log] [blame]
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001/*
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00002 * ismounted.c --- Check to see if the filesystem was mounted
Theodore Ts'oefc6f622008-08-27 23:07:54 -04003 *
Theodore Ts'occ860172001-05-25 16:32:53 +00004 * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o.
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00005 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Public
8 * License.
9 * %End-Header%
Theodore Ts'o50e1e101997-04-26 13:58:21 +000010 */
11
12#include <stdio.h>
13#if HAVE_UNISTD_H
14#include <unistd.h>
15#endif
Theodore Ts'oc4e749a1998-02-20 05:33:14 +000016#if HAVE_ERRNO_H
17#include <errno.h>
18#endif
Theodore Ts'o50e1e101997-04-26 13:58:21 +000019#include <fcntl.h>
Theodore Ts'o50e1e101997-04-26 13:58:21 +000020#ifdef HAVE_LINUX_FD_H
21#include <linux/fd.h>
22#endif
23#ifdef HAVE_MNTENT_H
24#include <mntent.h>
25#endif
26#ifdef HAVE_GETMNTINFO
27#include <paths.h>
28#include <sys/param.h>
29#include <sys/mount.h>
30#endif /* HAVE_GETMNTINFO */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +000031#include <string.h>
Theodore Ts'occ860172001-05-25 16:32:53 +000032#include <sys/stat.h>
Theodore Ts'o50e1e101997-04-26 13:58:21 +000033
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +000034#include "ext2_fs.h"
Theodore Ts'o50e1e101997-04-26 13:58:21 +000035#include "ext2fs.h"
36
37#ifdef HAVE_MNTENT_H
38/*
Theodore Ts'o52db0b42001-04-17 02:22:05 +000039 * Helper function which checks a file in /etc/mtab format to see if a
40 * filesystem is mounted. Returns an error if the file doesn't exist
Theodore Ts'oefc6f622008-08-27 23:07:54 -040041 * or can't be opened.
Theodore Ts'o50e1e101997-04-26 13:58:21 +000042 */
Theodore Ts'oefc6f622008-08-27 23:07:54 -040043static errcode_t check_mntent_file(const char *mtab_file, const char *file,
Theodore Ts'o52db0b42001-04-17 02:22:05 +000044 int *mount_flags, char *mtpt, int mtlen)
Theodore Ts'o50e1e101997-04-26 13:58:21 +000045{
Theodore Ts'o2038b632001-09-14 07:44:25 -040046 struct mntent *mnt;
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -050047 struct stat st_buf;
Theodore Ts'o2038b632001-09-14 07:44:25 -040048 errcode_t retval = 0;
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050049 dev_t file_dev=0, file_rdev=0;
50 ino_t file_ino=0;
Theodore Ts'o2038b632001-09-14 07:44:25 -040051 FILE *f;
52 int fd;
Theodore Ts'o50e1e101997-04-26 13:58:21 +000053
54 *mount_flags = 0;
Theodore Ts'o52db0b42001-04-17 02:22:05 +000055 if ((f = setmntent (mtab_file, "r")) == NULL)
Theodore Ts'o86522282009-05-29 00:09:57 -040056 return (errno == ENOENT ? EXT2_NO_MTAB_FILE : errno);
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050057 if (stat(file, &st_buf) == 0) {
58 if (S_ISBLK(st_buf.st_mode)) {
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -050059#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050060 file_rdev = st_buf.st_rdev;
Theodore Ts'of0efd292002-04-27 17:07:52 -040061#endif /* __GNU__ */
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050062 } else {
63 file_dev = st_buf.st_dev;
64 file_ino = st_buf.st_ino;
65 }
66 }
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -050067 while ((mnt = getmntent (f)) != NULL) {
Theodore Ts'of9110f42009-04-22 22:20:22 -040068 if (mnt->mnt_fsname[0] != '/')
69 continue;
Theodore Ts'o50e1e101997-04-26 13:58:21 +000070 if (strcmp(file, mnt->mnt_fsname) == 0)
71 break;
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050072 if (stat(mnt->mnt_fsname, &st_buf) == 0) {
73 if (S_ISBLK(st_buf.st_mode)) {
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -050074#ifndef __GNU__
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050075 if (file_rdev && (file_rdev == st_buf.st_rdev))
76 break;
Theodore Ts'of0efd292002-04-27 17:07:52 -040077#endif /* __GNU__ */
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050078 } else {
79 if (file_dev && ((file_dev == st_buf.st_dev) &&
80 (file_ino == st_buf.st_ino)))
81 break;
82 }
83 }
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -050084 }
Theodore Ts'occ860172001-05-25 16:32:53 +000085
86 if (mnt == 0) {
Theodore Ts'o66a46142001-06-13 23:26:19 +000087#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
Theodore Ts'occ860172001-05-25 16:32:53 +000088 /*
89 * Do an extra check to see if this is the root device. We
Theodore Ts'o2038b632001-09-14 07:44:25 -040090 * can't trust /etc/mtab, and /proc/mounts will only list
Theodore Ts'occ860172001-05-25 16:32:53 +000091 * /dev/root for the root filesystem. Argh. Instead we
92 * check if the given device has the same major/minor number
93 * as the device that the root directory is on.
94 */
Theodore Ts'o3a42fe22002-10-31 13:23:37 -050095 if (file_rdev && stat("/", &st_buf) == 0) {
96 if (st_buf.st_dev == file_rdev) {
Theodore Ts'occ860172001-05-25 16:32:53 +000097 *mount_flags = EXT2_MF_MOUNTED;
98 if (mtpt)
Theodore Ts'od5f858d2001-05-25 17:14:23 +000099 strncpy(mtpt, "/", mtlen);
Theodore Ts'occ860172001-05-25 16:32:53 +0000100 goto is_root;
101 }
102 }
Theodore Ts'of0efd292002-04-27 17:07:52 -0400103#endif /* __GNU__ */
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400104 goto errout;
Theodore Ts'occ860172001-05-25 16:32:53 +0000105 }
Theodore Ts'o2038b632001-09-14 07:44:25 -0400106#ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */
107 /* Validate the entry in case /etc/mtab is out of date */
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400108 /*
Theodore Ts'o2038b632001-09-14 07:44:25 -0400109 * We need to be paranoid, because some broken distributions
110 * (read: Slackware) don't initialize /etc/mtab before checking
111 * all of the non-root filesystems on the disk.
112 */
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -0500113 if (stat(mnt->mnt_dir, &st_buf) < 0) {
Theodore Ts'o2038b632001-09-14 07:44:25 -0400114 retval = errno;
115 if (retval == ENOENT) {
116#ifdef DEBUG
117 printf("Bogus entry in %s! (%s does not exist)\n",
118 mtab_file, mnt->mnt_dir);
Theodore Ts'of0efd292002-04-27 17:07:52 -0400119#endif /* DEBUG */
Theodore Ts'o2038b632001-09-14 07:44:25 -0400120 retval = 0;
121 }
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400122 goto errout;
Theodore Ts'o2038b632001-09-14 07:44:25 -0400123 }
Theodore Ts'o3a42fe22002-10-31 13:23:37 -0500124 if (file_rdev && (st_buf.st_dev != file_rdev)) {
Theodore Ts'o2038b632001-09-14 07:44:25 -0400125#ifdef DEBUG
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -0500126 printf("Bogus entry in %s! (%s not mounted on %s)\n",
127 mtab_file, file, mnt->mnt_dir);
Theodore Ts'of0efd292002-04-27 17:07:52 -0400128#endif /* DEBUG */
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400129 goto errout;
Theodore Ts'o2038b632001-09-14 07:44:25 -0400130 }
Theodore Ts'of0efd292002-04-27 17:07:52 -0400131#endif /* __GNU__ */
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000132 *mount_flags = EXT2_MF_MOUNTED;
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400133
Theodore Ts'offf45482003-04-13 00:44:19 -0400134#ifdef MNTOPT_RO
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000135 /* Check to see if the ro option is set */
136 if (hasmntopt(mnt, MNTOPT_RO))
137 *mount_flags |= EXT2_MF_READONLY;
Theodore Ts'offf45482003-04-13 00:44:19 -0400138#endif
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000139
Theodore Ts'occ860172001-05-25 16:32:53 +0000140 if (mtpt)
141 strncpy(mtpt, mnt->mnt_dir, mtlen);
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000142 /*
143 * Check to see if we're referring to the root filesystem.
144 * If so, do a manual check to see if we can open /etc/mtab
Theodore Ts'occ860172001-05-25 16:32:53 +0000145 * read/write, since if the root is mounted read/only, the
146 * contents of /etc/mtab may not be accurate.
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000147 */
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000148 if (!strcmp(mnt->mnt_dir, "/")) {
Theodore Ts'occ860172001-05-25 16:32:53 +0000149is_root:
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400150#define TEST_FILE "/.ismount-test-file"
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000151 *mount_flags |= EXT2_MF_ISROOT;
Andreas Dilger8cdd6a62007-11-08 18:20:15 -0700152 fd = open(TEST_FILE, O_RDWR|O_CREAT, 0600);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000153 if (fd < 0) {
154 if (errno == EROFS)
155 *mount_flags |= EXT2_MF_READONLY;
156 } else
157 close(fd);
Theodore Ts'o997b8202001-06-15 18:33:43 +0000158 (void) unlink(TEST_FILE);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000159 }
Theodore Ts'o2038b632001-09-14 07:44:25 -0400160 retval = 0;
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400161errout:
Theodore Ts'occ860172001-05-25 16:32:53 +0000162 endmntent (f);
Theodore Ts'o2038b632001-09-14 07:44:25 -0400163 return retval;
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000164}
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000165
166static errcode_t check_mntent(const char *file, int *mount_flags,
167 char *mtpt, int mtlen)
168{
169 errcode_t retval;
170
Theodore Ts'o2038b632001-09-14 07:44:25 -0400171#ifdef DEBUG
172 retval = check_mntent_file("/tmp/mtab", file, mount_flags,
173 mtpt, mtlen);
174 if (retval == 0)
175 return 0;
Theodore Ts'of0efd292002-04-27 17:07:52 -0400176#endif /* DEBUG */
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000177#ifdef __linux__
178 retval = check_mntent_file("/proc/mounts", file, mount_flags,
179 mtpt, mtlen);
Theodore Ts'o3a42fe22002-10-31 13:23:37 -0500180 if (retval == 0 && (*mount_flags != 0))
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000181 return 0;
Theodore Ts'of0efd292002-04-27 17:07:52 -0400182#endif /* __linux__ */
Theodore Ts'o5818d672002-06-27 21:19:45 -0400183#if defined(MOUNTED) || defined(_PATH_MOUNTED)
184#ifndef MOUNTED
185#define MOUNTED _PATH_MOUNTED
186#endif /* MOUNTED */
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000187 retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen);
188 return retval;
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400189#else
Theodore Ts'o5818d672002-06-27 21:19:45 -0400190 *mount_flags = 0;
191 return 0;
192#endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000193}
194
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400195#else
196#if defined(HAVE_GETMNTINFO)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000197
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000198static errcode_t check_getmntinfo(const char *file, int *mount_flags,
199 char *mtpt, int mtlen)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000200{
201 struct statfs *mp;
202 int len, n;
203 const char *s1;
204 char *s2;
205
206 n = getmntinfo(&mp, MNT_NOWAIT);
207 if (n == 0)
208 return errno;
209
210 len = sizeof(_PATH_DEV) - 1;
211 s1 = file;
212 if (strncmp(_PATH_DEV, s1, len) == 0)
213 s1 += len;
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400214
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000215 *mount_flags = 0;
216 while (--n >= 0) {
217 s2 = mp->f_mntfromname;
218 if (strncmp(_PATH_DEV, s2, len) == 0) {
219 s2 += len - 1;
220 *s2 = 'r';
221 }
222 if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) {
223 *mount_flags = EXT2_MF_MOUNTED;
224 break;
225 }
226 ++mp;
227 }
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000228 if (mtpt)
229 strncpy(mtpt, mp->f_mntonname, mtlen);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000230 return 0;
231}
232#endif /* HAVE_GETMNTINFO */
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400233#endif /* HAVE_MNTENT_H */
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000234
235/*
Theodore Ts'of0efd292002-04-27 17:07:52 -0400236 * Check to see if we're dealing with the swap device.
237 */
238static int is_swap_device(const char *file)
239{
240 FILE *f;
241 char buf[1024], *cp;
242 dev_t file_dev;
243 struct stat st_buf;
244 int ret = 0;
245
246 file_dev = 0;
247#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
248 if ((stat(file, &st_buf) == 0) &&
249 S_ISBLK(st_buf.st_mode))
250 file_dev = st_buf.st_rdev;
251#endif /* __GNU__ */
252
253 if (!(f = fopen("/proc/swaps", "r")))
254 return 0;
255 /* Skip the first line */
Karel Zak5f915612009-10-13 13:52:59 +0000256 if (!fgets(buf, sizeof(buf), f))
257 goto leave;
258 if (*buf && strncmp(buf, "Filename\t", 9))
259 /* Linux <=2.6.19 contained a bug in the /proc/swaps
260 * code where the header would not be displayed
261 */
262 goto valid_first_line;
263
Dmitry V. Levind9039ae2007-10-20 22:08:40 +0400264 while (fgets(buf, sizeof(buf), f)) {
Karel Zak5f915612009-10-13 13:52:59 +0000265valid_first_line:
Theodore Ts'of0efd292002-04-27 17:07:52 -0400266 if ((cp = strchr(buf, ' ')) != NULL)
267 *cp = 0;
268 if ((cp = strchr(buf, '\t')) != NULL)
269 *cp = 0;
270 if (strcmp(buf, file) == 0) {
271 ret++;
272 break;
273 }
274#ifndef __GNU__
275 if (file_dev && (stat(buf, &st_buf) == 0) &&
276 S_ISBLK(st_buf.st_mode) &&
277 file_dev == st_buf.st_rdev) {
278 ret++;
279 break;
280 }
281#endif /* __GNU__ */
282 }
Karel Zak5f915612009-10-13 13:52:59 +0000283
284leave:
Theodore Ts'of0efd292002-04-27 17:07:52 -0400285 fclose(f);
286 return ret;
287}
288
289
290/*
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400291 * ext2fs_check_mount_point() fills determines if the device is
292 * mounted or otherwise busy, and fills in mount_flags with one or
293 * more of the following flags: EXT2_MF_MOUNTED, EXT2_MF_ISROOT,
294 * EXT2_MF_READONLY, EXT2_MF_SWAP, and EXT2_MF_BUSY. If mtpt is
295 * non-NULL, the directory where the device is mounted is copied to
296 * where mtpt is pointing, up to mtlen characters.
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000297 */
298#ifdef __TURBOC__
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000299 #pragma argsused
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000300#endif
301errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
302 char *mtpt, int mtlen)
303{
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400304 struct stat st_buf;
305 errcode_t retval = 0;
306 int fd;
307
Theodore Ts'o07cefe72001-12-24 15:20:22 -0500308 if (is_swap_device(device)) {
309 *mount_flags = EXT2_MF_MOUNTED | EXT2_MF_SWAP;
310 strncpy(mtpt, "<swap>", mtlen);
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400311 } else {
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000312#ifdef HAVE_MNTENT_H
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400313 retval = check_mntent(device, mount_flags, mtpt, mtlen);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400314#else
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000315#ifdef HAVE_GETMNTINFO
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400316 retval = check_getmntinfo(device, mount_flags, mtpt, mtlen);
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000317#else
Theodore Ts'oed78c022003-03-06 11:09:18 -0500318#ifdef __GNUC__
Theodore Ts'o48e6e812003-07-06 00:36:48 -0400319 #warning "Can't use getmntent or getmntinfo to check for mounted filesystems!"
Theodore Ts'oed78c022003-03-06 11:09:18 -0500320#endif
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400321 *mount_flags = 0;
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000322#endif /* HAVE_GETMNTINFO */
323#endif /* HAVE_MNTENT_H */
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400324 }
325 if (retval)
326 return retval;
327
328#ifdef __linux__ /* This only works on Linux 2.6+ systems */
329 if ((stat(device, &st_buf) != 0) ||
330 !S_ISBLK(st_buf.st_mode))
331 return 0;
332 fd = open(device, O_RDONLY | O_EXCL);
333 if (fd < 0) {
334 if (errno == EBUSY)
335 *mount_flags |= EXT2_MF_BUSY;
336 } else
337 close(fd);
Matthias Andree406ba672006-05-30 16:28:22 +0200338#endif
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400339
340 return 0;
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000341}
342
343/*
Theodore Ts'o6bd13482001-06-14 07:00:55 +0000344 * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED,
Theodore Ts'od5f858d2001-05-25 17:14:23 +0000345 * EXT2_MF_READONLY, and EXT2_MF_ROOT
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400346 *
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000347 */
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000348errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags)
349{
Theodore Ts'od5f858d2001-05-25 17:14:23 +0000350 return ext2fs_check_mount_point(file, mount_flags, NULL, 0);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000351}
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000352
353#ifdef DEBUG
354int main(int argc, char **argv)
355{
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000356 int retval, mount_flags;
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -0500357 char mntpt[80];
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400358
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000359 if (argc < 2) {
360 fprintf(stderr, "Usage: %s device\n", argv[0]);
361 exit(1);
362 }
363
Theodore Ts'o04f13d62009-09-08 21:33:03 -0400364 add_error_table(&et_ext2_error_table);
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -0500365 mntpt[0] = 0;
366 retval = ext2fs_check_mount_point(argv[1], &mount_flags,
367 mntpt, sizeof(mntpt));
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000368 if (retval) {
369 com_err(argv[0], retval,
370 "while calling ext2fs_check_if_mounted");
371 exit(1);
372 }
373 printf("Device %s reports flags %02x\n", argv[1], mount_flags);
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400374 if (mount_flags & EXT2_MF_BUSY)
375 printf("\t%s is apparently in use.\n", argv[1]);
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000376 if (mount_flags & EXT2_MF_MOUNTED)
Theodore Ts'occ860172001-05-25 16:32:53 +0000377 printf("\t%s is mounted.\n", argv[1]);
Theodore Ts'o07cefe72001-12-24 15:20:22 -0500378 if (mount_flags & EXT2_MF_SWAP)
379 printf("\t%s is a swap device.\n", argv[1]);
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000380 if (mount_flags & EXT2_MF_READONLY)
Theodore Ts'occ860172001-05-25 16:32:53 +0000381 printf("\t%s is read-only.\n", argv[1]);
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000382 if (mount_flags & EXT2_MF_ISROOT)
Theodore Ts'occ860172001-05-25 16:32:53 +0000383 printf("\t%s is the root filesystem.\n", argv[1]);
Theodore Ts'oa8fd6e32001-12-24 01:40:35 -0500384 if (mntpt[0])
385 printf("\t%s is mounted on %s.\n", argv[1], mntpt);
Theodore Ts'o52db0b42001-04-17 02:22:05 +0000386 exit(0);
387}
Theodore Ts'of0efd292002-04-27 17:07:52 -0400388#endif /* DEBUG */