From: Marek Vasut Date: Sat, 1 Sep 2012 00:44:13 +0200 Subject: [U-Boot] [PATCH 4/6] stdio: dm: Add stdio_fd_to_name() call In-Reply-To: <1346453055-30888-1-git-send-email-marex@denx.de> References: <1346453055-30888-1-git-send-email-marex@denx.de> Message-ID: <1346453055-30888-5-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add stdio_fd_to_name() function, which convers the STDIO FD number to a proper name. Signed-off-by: Marek Vasut Cc: Wolfgang Denk --- common/stdio.c | 12 ++++++++++++ include/stdio_dev.h | 1 + 2 files changed, 13 insertions(+) diff --git a/common/stdio.c b/common/stdio.c index ba5e2fc..0e917fd 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -166,6 +166,18 @@ struct stdio_dev* stdio_clone(struct stdio_dev *dev) return _dev; } +const char *stdio_fd_to_name(int ioe) +{ + switch (ioe) { + case stdin: + case stdout: + case stderr: + return stdio_names[ioe]; + default: + return NULL; + } +} + int stdio_register (struct stdio_dev * dev) { struct stdio_dev *_dev; diff --git a/include/stdio_dev.h b/include/stdio_dev.h index 554708a..7299735 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -98,6 +98,7 @@ struct list_head* stdio_get_list(void); struct stdio_dev* stdio_get_by_name(const char* name); struct stdio_dev *stdio_get_fd(int ioe); int stdio_set_fd(int ioe, struct stdio_dev *dev); +const char *stdio_fd_to_name(int ioe); struct stdio_dev* stdio_clone(struct stdio_dev *dev); #ifdef CONFIG_ARM_DCC_MULTI -- 1.7.10.4