Re: [PATCH 06/10] restore: Add regex matching of paths and files to be restored

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Zach,

Zach Brown wrote:
> > In order to restore only a single folder somewhere in the btrfs
> > tree, it is unfortunately neccessary to construct a slightly
> > nontrivial regex, e.g.:
> > 
> > restore -m '^/(|home(|/username(|/Desktop(|/.*))))$' /dev/sdb2 /output
> 
> But that example is just bonkers

I agree ugly, but why bonkers (I understand that to mean silly) ?


> and suggests that we should also support globs for fnmatch(3).
> (-g is for glob? :))

I like the idea better than my regex. The implementation doing
matching should however iterate over all path components, so that
it's not neccessary to do

-g / -g /home -g /home/username -g /home/username/Desktop -g '/home/username/Desktop/*'

but to make this suffice:

-g '/home/username/Desktop/*'

Chopping up the string is easy enough.


> > +	if (match_regstr) {
> > +		ret = regcomp(&match_reg, match_regstr, match_cflags);
> 
> And this should probably be in a helper function.  Especially if it
> also grows fnmatch() support.

I agree. Maybe I'll take some time to make the changes tomorrow.


//Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux