HomeFreeBSD

pseudofs: return errors from pfs_create_*()

Description

pseudofs: return errors from pfs_create_*()

In D52038, we kind of guess at the reason that pfs_create_dir() failed,
which isn't great: it could be EEXISTS, or it could even be ENOMEM.

Change the pfs_create_*() interfaces to return an error and use a double
pointer to return the new node as requested. Outside of the changes
in sys/fs/pseudofs, this diff is the result of running the added
coccinelle script against in-tree pseudofs and fixing all of the
style(9) violations that spatch added.

We set *opn to NULL in the failure cases to avoid breaking callers that
did actually error-check their results, since the cocci patch does not
attempt to handle that in any way.

Reviewed by: des (previous version), kib
Differential Revision: https://reviews.freebsd.org/D52157

Details

Provenance
kevansAuthored on Sep 4 2025, 2:08 AM
Reviewer
des
Differential Revision
D52157: pseudofs: return errors from pfs_create_*()
Parents
rG65059dd2b6f9: pseudofs: defer initialization until first mount
Branches
Unknown
Tags
Unknown