+ else
+ {
+ struct directory *d = find_directory_meta (stat_data->st_dev,
+ stat_data->st_ino);
+
+ directory = note_directory (name_buffer,
+ get_stat_mtime(stat_data),
+ stat_data->st_dev,
+ stat_data->st_ino,
+ nfs,
+ true,
+ NULL);
+
+ if (d)
+ {
+ if (verbose)
+ WARN ((0, 0, _("%s: Directory has been renamed from %s"),
+ quotearg_colon (name_buffer),
+ quote_n (1, d->name)));
+ directory->orig = d;
+ DIR_SET_FLAG (directory, DIRF_RENAMED);
+ directory->children = CHANGED_CHILDREN;
+ }
+ else
+ {
+ DIR_SET_FLAG (directory, DIRF_NEW);
+ if (verbose)
+ WARN ((0, 0, _("%s: Directory is new"),
+ quotearg_colon (name_buffer)));
+ directory->children =
+ (listed_incremental_option
+ || (OLDER_STAT_TIME (*stat_data, m)
+ || (after_date_option
+ && OLDER_STAT_TIME (*stat_data, c))))
+ ? ALL_CHILDREN
+ : CHANGED_CHILDREN;
+ }
+ }
+
+ /* If the directory is on another device and --one-file-system was given,
+ omit it... */
+ if (one_file_system_option && device != stat_data->st_dev
+ /* ... except if it was explicitely given in the command line */
+ && !is_individual_file (name_buffer))
+ directory->children = NO_CHILDREN;
+ else if (children == ALL_CHILDREN)
+ directory->children = ALL_CHILDREN;
+
+ DIR_SET_FLAG (directory, DIRF_INIT);
+
+ {
+ const char *tag_file_name;
+
+ switch (check_exclusion_tags (name_buffer, &tag_file_name))
+ {
+ case exclusion_tag_all:
+ /* This warning can be duplicated by code in dump_file0, but only
+ in case when the topmost directory being archived contains
+ an exclusion tag. */
+ exclusion_tag_warning (name_buffer, tag_file_name,
+ _("directory not dumped"));
+ if (entry)
+ *entry = 'N';
+ directory->children = NO_CHILDREN;
+ break;
+
+ case exclusion_tag_contents:
+ exclusion_tag_warning (name_buffer, tag_file_name,
+ _("contents not dumped"));
+ directory->children = NO_CHILDREN;
+ break;
+
+ case exclusion_tag_under:
+ exclusion_tag_warning (name_buffer, tag_file_name,
+ _("contents not dumped"));
+ directory->tagfile = tag_file_name;
+ break;
+
+ case exclusion_tag_none:
+ break;
+ }
+ }
+
+ return directory;
+}
+
+/* Locate NAME in the dumpdir array DUMP.
+ Return pointer to the slot in the array, or NULL if not found */
+const char *
+dumpdir_locate (const char *dump, const char *name)
+{
+ if (dump)
+ while (*dump)
+ {
+ /* Ignore 'R' (rename) and 'X' (tempname) entries, since they break
+ alphabetical ordering.
+ They normally do not occur in dumpdirs from the snapshot files,
+ but this function is also used by purge_directory, which operates
+ on a dumpdir from the archive, hence the need for this test. */
+ if (!strchr ("RX", *dump))
+ {
+ int rc = strcmp (dump + 1, name);
+ if (rc == 0)
+ return dump;
+ if (rc > 1)
+ break;
+ }
+ dump += strlen (dump) + 1;
+ }