Refactor the file ownership checks so that callers can provide discrete information about the ownership expectations to a single function.