The attached patch (against 2.4.10) adds a user_path_walk_parent() macro
in fs.h, and uses it to clean up some repetitive code in fs/namei.c.
Basically, variations on the sequence:
tmp = getname(path)
if(!IS_ERR(tmp)) {
if(!path_init(tmp, LOOKUP_PARENT, &nd))
error = path_walk(tmp, &nd);
if(!error) {
error = do_stuff_with_parentdir();
path_release(&nd);
}
putname(tmp);
}
are replaced with:
error = user_path_walk_parent(path, &nd);
if(!error) {
error = do_stuff_with_parentdir();
path_release(&nd);
}
Paul