yamt commented on PR #15535: URL: https://github.com/apache/nuttx/pull/15535#issuecomment-2591587419
> > my suggestion > > introduce a hostfs backend api like: > > ``` > > int host_convert_errno_to_nuttx(int host_error, int default_error) > > ``` > > > > > > > > > > > > > > > > > > > > > > > > this PR can use > > ```c > > ret = -host_convert_errno_to_nuttx(-hf->fd, EBADF); > > ``` > > but you don't know whether the error code is EBADF at all. hostfs_open returns EBADF for any errors. this EBADF is to preserve the behavior when a better conversion is not provided by the backend implementation. > > > an implementation for arch/sim/src/sim/posix/sim_hostfs.c can be > > ```c > > int host_convert_errno_to_nuttx(int host_error, int default_error) > > ``` > > the prototype should be: > > ``` > int host_convert_errno_to_nuttx(int host_error) > ``` > > > { > > #if defined(CONFIG_HOST_LINUX) > > return host_errno; > > #else > > if (host_error == 0) > > { > > return 0; > > } > > return default_error; > > #endif > > } > > ALL functions return errno from host directly in the current code base, it's better to create a new pr to fix ALL location instead only patching this line. maybe. or, make them convert the error number by themselves and return nuttx errno. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org