+
+/* Return nonzero if file NAME is excluded. Exclude a name if its
+ prefix matches a pattern that contains slashes, or if one of its
+ components matches a pattern that contains no slashes. */
+bool
+excluded_name (char const *name)
+{
+ return excluded_filename (excluded, name + FILESYSTEM_PREFIX_LEN (name));
+}
+\f
+/* Names to avoid dumping. */
+static Hash_table *avoided_name_table;
+
+/* Calculate the hash of an avoided name. */
+static unsigned
+hash_avoided_name (void const *name, unsigned n_buckets)
+{
+ return hash_string (name, n_buckets);
+}
+
+/* Compare two avoided names for equality. */
+static bool
+compare_avoided_names (void const *name1, void const *name2)
+{
+ return strcmp (name1, name2) == 0;
+}
+
+/* Remember to not archive NAME. */
+void
+add_avoided_name (char const *name)
+{
+ if (! ((avoided_name_table
+ || (avoided_name_table = hash_initialize (0, 0, hash_avoided_name,
+ compare_avoided_names, 0)))
+ && hash_insert (avoided_name_table, xstrdup (name))))
+ xalloc_die ();
+}
+
+/* Should NAME be avoided when archiving? */
+int
+is_avoided_name (char const *name)
+{
+ return avoided_name_table && hash_lookup (avoided_name_table, name);
+}