e9eba06b9a9da0b5341d1eaf834097438cb824a8
[platform/upstream/coreutils.git] / lib / root-dev-ino.h
1 #ifndef ROOT_DEV_INO_H
2 # define ROOT_DEV_INO_H 1
3
4 # include "dev-ino.h"
5 # include "same-inode.h"
6
7 struct dev_ino *
8 get_root_dev_ino (struct dev_ino *root_d_i);
9
10 /* These macros are common to the programs that support the
11    --preserve-root and --no-preserve-root options.  */
12
13 # define ROOT_DEV_INO_CHECK(Root_dev_ino, Dir_statbuf) \
14     (Root_dev_ino && SAME_INODE (*Dir_statbuf, *Root_dev_ino))
15
16 # define ROOT_DEV_INO_WARN(Dirname)                                     \
17   do                                                                    \
18     {                                                                   \
19       if (STREQ (Dirname, "/"))                                         \
20         error (0, 0, _("it is dangerous to operate recursively on %s"), \
21                quote (Dirname));                                        \
22       else                                                              \
23         error (0, 0,                                                    \
24                _("it is dangerous to operate recursively on %s (same as %s)"), \
25                quote_n (0, Dirname), quote_n (1, "/"));                 \
26       error (0, 0, _("use --no-preserve-root to override this failsafe")); \
27     }                                                                   \
28   while (0)
29
30 #endif