[PATCH U-BOOT 18/26] fs: btrfs: Implement btrfs_lookup_path()

Marek Behun marek.behun at nic.cz
Wed Apr 22 12:04:51 CEST 2020


On Wed, 22 Apr 2020 17:46:25 +0800
Su Yue <Damenly_Su at gmx.com> wrote:

> > +	while (*cur != '\0') {
> > +
> > +		cur = skip_current_directories(cur);
> > +		len = next_length(cur);
> > +		if (len > BTRFS_NAME_LEN) {  
> 
> next_length() promises @len <= BTRFS_NAME_LEN, so the check is trivial.

Hmm. This is a bug in next_length. I meant for next_length to return
len > BTRFS_NAME_LEN in case of too long name. Thanks for noticing.

> > +			ret = btrfs_readlink(root, ino, target);
> > +			if (ret < 0) {
> > +				free(target);
> > +				return ret;
> > +			}
> > +			target[ret] = '\0';  
> 
> It was done in btrfs_readlink() already.

It is in old btrfs_readlink, but is it even after this patches? I don't
see it in the new implementation.

> > +
> > +			ret = btrfs_lookup_path(root, ino, target, &next_root,
> > +						&next_ino, &next_type,
> > +						symlink_limit);  
> 
> Just notify gentlely this is a recursive call here. I don't know
> whether uboot cares about stack things. But, recursion makes coding simpler :).

It is limited by symlink_limit. Until somebody complains about stack
issues I would like to keep it simple.


More information about the U-Boot mailing list