• G
    9pfs: local: simplify file opening · 3dbcf273
    Greg Kurz 提交于
    The logic to open a path currently sits between local_open_nofollow() and
    the relative_openat_nofollow() helper, which has no other user.
    
    For the sake of clarity, this patch moves all the code of the helper into
    its unique caller. While here we also:
    - drop the code to skip leading "/" because the backend isn't supposed to
      pass anything but relative paths without consecutive slashes. The assert()
      is kept because we really don't want a buggy backend to pass an absolute
      path to openat().
    - use strchrnul() to get a simpler code. This is ok since virtfs is for
      linux+glibc hosts only.
    - don't dup() the initial directory and add an assert() to ensure we don't
      return the global mountfd to the caller. BTW, this would mean that the
      caller passed an empty path, which isn't supposed to happen either.
    Signed-off-by: NGreg Kurz <groug@kaod.org>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    [groug: fixed typos in changelog]
    3dbcf273
9p-util.h 1.4 KB