* Skip spurious slashes in a pathname (e.g., "foo///bar") and retry. * * Lockless lookup tries to elide checking for spurious slashes and should they * be present is guaranteed to fail to find an entry. In this case the caller * must check if the name starts with a slash and call this routine. It is * going to fast forward across the spurious slashes and set the state up for * retry. */
| 5339 | * retry. |
| 5340 | */ |
| 5341 | static int __noinline |
| 5342 | cache_fplookup_skip_slashes(struct cache_fpl *fpl) |
| 5343 | { |
| 5344 | struct nameidata *ndp; |
| 5345 | struct componentname *cnp; |
| 5346 | |
| 5347 | ndp = fpl->ndp; |
| 5348 | cnp = fpl->cnp; |
| 5349 | |
| 5350 | MPASS(*(cnp->cn_nameptr) == '/'); |
| 5351 | do { |
| 5352 | cnp->cn_nameptr++; |
| 5353 | cache_fpl_pathlen_dec(fpl); |
| 5354 | } while (*(cnp->cn_nameptr) == '/'); |
| 5355 | |
| 5356 | /* |
| 5357 | * Go back to one slash so that cache_fplookup_parse_advance has |
| 5358 | * something to skip. |
| 5359 | */ |
| 5360 | cnp->cn_nameptr--; |
| 5361 | cache_fpl_pathlen_inc(fpl); |
| 5362 | |
| 5363 | /* |
| 5364 | * cache_fplookup_parse_advance starts from ndp->ni_next |
| 5365 | */ |
| 5366 | ndp->ni_next = cnp->cn_nameptr; |
| 5367 | |
| 5368 | /* |
| 5369 | * See cache_fplookup_dot. |
| 5370 | */ |
| 5371 | fpl->tvp = fpl->dvp; |
| 5372 | fpl->tvp_seqc = fpl->dvp_seqc; |
| 5373 | |
| 5374 | return (0); |
| 5375 | } |
| 5376 | |
| 5377 | /* |
| 5378 | * Handle trailing slashes (e.g., "foo/"). |
no test coverage detected