mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 13:23:00 +08:00
Introduce new shared function remote_fileio_to_fio_error
This commit introduces a new shared function to replace three identical functions in various places in the codebase. gdb/ChangeLog: * common/common-remote-fileio.h (remote_fileio_to_fio_error): New declaration. * common/common-remote-fileio.c (remote_fileio_to_fio_error): New function, factored out the named functions below. * inf-child.c (gdb/fileio.h): Remove include. (common-remote-fileio.h): New include. (inf_child_errno_to_fileio_error): Remove function. Update all callers to use remote_fileio_to_fio_error. * remote-fileio.c (remote_fileio_errno_to_target): Likewise. gdb/gdbserver/ChangeLog: * hostio-errno.c (errno_to_fileio_error): Remove function. Update caller to use remote_fileio_to_fio_error.
This commit is contained in:
@ -193,57 +193,6 @@ remote_fileio_mode_to_host (long mode, int open_call)
|
||||
return hmode;
|
||||
}
|
||||
|
||||
static int
|
||||
remote_fileio_errno_to_target (int error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case EPERM:
|
||||
return FILEIO_EPERM;
|
||||
case ENOENT:
|
||||
return FILEIO_ENOENT;
|
||||
case EINTR:
|
||||
return FILEIO_EINTR;
|
||||
case EIO:
|
||||
return FILEIO_EIO;
|
||||
case EBADF:
|
||||
return FILEIO_EBADF;
|
||||
case EACCES:
|
||||
return FILEIO_EACCES;
|
||||
case EFAULT:
|
||||
return FILEIO_EFAULT;
|
||||
case EBUSY:
|
||||
return FILEIO_EBUSY;
|
||||
case EEXIST:
|
||||
return FILEIO_EEXIST;
|
||||
case ENODEV:
|
||||
return FILEIO_ENODEV;
|
||||
case ENOTDIR:
|
||||
return FILEIO_ENOTDIR;
|
||||
case EISDIR:
|
||||
return FILEIO_EISDIR;
|
||||
case EINVAL:
|
||||
return FILEIO_EINVAL;
|
||||
case ENFILE:
|
||||
return FILEIO_ENFILE;
|
||||
case EMFILE:
|
||||
return FILEIO_EMFILE;
|
||||
case EFBIG:
|
||||
return FILEIO_EFBIG;
|
||||
case ENOSPC:
|
||||
return FILEIO_ENOSPC;
|
||||
case ESPIPE:
|
||||
return FILEIO_ESPIPE;
|
||||
case EROFS:
|
||||
return FILEIO_EROFS;
|
||||
case ENOSYS:
|
||||
return FILEIO_ENOSYS;
|
||||
case ENAMETOOLONG:
|
||||
return FILEIO_ENAMETOOLONG;
|
||||
}
|
||||
return FILEIO_EUNKNOWN;
|
||||
}
|
||||
|
||||
static int
|
||||
remote_fileio_seek_flag_to_host (long num, int *flag)
|
||||
{
|
||||
@ -459,7 +408,7 @@ static void
|
||||
remote_fileio_return_errno (int retcode)
|
||||
{
|
||||
remote_fileio_reply (retcode, retcode < 0
|
||||
? remote_fileio_errno_to_target (errno) : 0);
|
||||
? remote_fileio_to_fio_error (errno) : 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user