From: Karel Zak Date: Tue, 5 Nov 2024 09:59:13 +0000 (+0100) Subject: Merge branch 'PR/hardlink-nftw-imrovements' of https://github.com/karelzak/util-linux... X-Git-Tag: v2.42-start~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=472f89cce0ded69076649aadbcc906dbc913a823;p=thirdparty%2Futil-linux.git Merge branch 'PR/hardlink-nftw-imrovements' of https://github.com/karelzak/util-linux-work * 'PR/hardlink-nftw-imrovements' of https://github.com/karelzak/util-linux-work: hardlink: implement --mount hardlink: add missing verbose messages and unify them hardlink: implement --exclude-subtree --- 472f89cce0ded69076649aadbcc906dbc913a823 diff --cc misc-utils/hardlink.c index e996f53b5,2d3861c98..899c0d635 --- a/misc-utils/hardlink.c +++ b/misc-utils/hardlink.c @@@ -189,8 -195,7 +195,9 @@@ static struct options unsigned int keep_oldest:1; unsigned int prio_trees:1; unsigned int dry_run:1; + unsigned int list_duplicates:1; + char line_delim; + unsigned int within_mount:1; uintmax_t min_size; uintmax_t max_size; size_t io_size; @@@ -841,9 -850,19 +848,18 @@@ static int inserter(const char *fpath, int included; int excluded; - if (handle_interrupt()) - return 1; + handle_interrupt(); if (typeflag == FTW_DNR || typeflag == FTW_NS) warn(_("cannot read %s"), fpath); + #ifdef USE_SKIP_SUBTREE + if (opts.exclude_subtree + && typeflag == FTW_D + && match_any_regex(opts.exclude_subtree, fpath)) { + jlog(JLOG_VERBOSE1, + _("Skipped (excluded subtree) %s"), fpath); + return FTW_SKIP_SUBTREE; + } + #endif if (typeflag != FTW_F || !S_ISREG(sb->st_mode)) return 0; @@@ -1222,9 -1244,11 +1245,11 @@@ static int parse_options(int argc, cha { enum { OPT_REFLINK = CHAR_MAX + 1, - OPT_SKIP_RELINKS + OPT_SKIP_RELINKS, + OPT_EXCLUDE_SUBTREE, + OPT_MOUNT }; - static const char optstr[] = "VhvndfpotXcmMFOx:y:i:r:S:s:b:q"; + static const char optstr[] = "VhvndfpotXcmMFOlzx:y:i:r:S:s:b:q"; static const struct option long_options[] = { {"version", no_argument, NULL, 'V'}, {"help", no_argument, NULL, 'h'},