• Al Viro's avatar
    d_path: lift -ENAMETOOLONG handling into callers of prepend_path() · 01a4428e
    Al Viro authored
    The only negative value ever returned by prepend_path() is -ENAMETOOLONG
    and callers can recognize that situation (overflow) by looking at the
    sign of buflen.  Lift that into the callers; we already have the
    same logics (buf if buflen is non-negative, ERR_PTR(-ENAMETOOLONG) otherwise)
    in several places and that'll become a new primitive several commits down
    the road.
    
    Make prepend_path() return 0 instead of -ENAMETOOLONG.  That makes for
    saner calling conventions (0/1/2/3/-ENAMETOOLONG is obnoxious) and
    callers actually get simpler, especially once the aforementioned
    primitive gets added.
    
    In prepend_path() itself we switch prepending the / (in case of
    empty path) to use of prepend() - no need to open-code that, compiler
    will do the right thing.  It's exactly the same logics as in
    __dentry_path().
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    01a4428e
d_path.c 10.6 KB