]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib, StdLibPrivateInternalFiles: Clean up comments, Remove debugging code, Define...
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 20 Sep 2012 21:01:21 +0000 (21:01 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 20 Sep 2012 21:01:21 +0000 (21:01 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com>
Reviewed-by: Jaben Carsey <jcarsey@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13735 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/Include/sys/stat.h
StdLib/Include/sys/syslimits.h
StdLib/Include/wchar.h
StdLib/LibC/Stdio/refill.c
StdLibPrivateInternalFiles/Include/kfile.h

index 6c5d5a80783c87a7b4e52c044967401c639a7f50..12520be83ab842c70ec2d9220a5ab9e40a02924b 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-    Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+    Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
     This program and the accompanying materials are licensed and made\r
     available under  the terms and conditions of the BSD License that\r
     accompanies this distribution. The full text of the license may be found at\r
@@ -90,16 +90,18 @@ struct stat {
 /*  The Octal access modes, above, fall into the Hex mask 0x00000FFF.\r
     Traditionally, the remainder of the flags are specified in Octal\r
     but they are expressed in Hex here for modern clarity.\r
+\r
+    The basic file types, specified within 0x0000F000, are mutually exclusive.\r
 */\r
 #define _S_IFMT       0x000FF000   ///< type-of-file mask\r
 #define _S_IFIFO      0x00001000   ///< named pipe (fifo)\r
-#define _S_IFCHR      0x00002000   ///< character special\r
+#define _S_IFCHR      0x00002000   ///< character special device\r
 #define _S_IFDIR      0x00004000   ///< directory\r
-#define _S_IFBLK      0x00006000   ///< block special\r
+#define _S_IFBLK      0x00006000   ///< block special device\r
 #define _S_IFREG      0x00008000   ///< regular\r
 #define _S_IFSOCK     0x0000C000   ///< socket\r
 #define _S_ITTY       0x00010000   ///< File connects to a TTY device\r
-#define _S_IWTTY      0x00020000   ///< TTY receives Wide characters\r
+#define _S_IWTTY      0x00020000   ///< TTY sends and receives Wide characters\r
 #define _S_ICONSOLE   0x00030000   ///< UEFI Console Device\r
 \r
 /*  UEFI specific (FAT file system) File attributes.\r
index bee810cc12bf5fc1f085913a3936c9961bfe7c59..9515e8f5700a9a81fd3186baa9b4449c232608f0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Platform specific values for <limits.h>.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available under\r
   the terms and conditions of the BSD License that accompanies this distribution.\r
   The full text of the license may be found at\r
@@ -50,6 +50,7 @@
 #define ARGC_MAX          (64)  ///< Maximum value for argc.\r
 \r
 #define MAX_INPUT         255   ///< Maximum bytes in terminal input.\r
+#define MAX_OUTPUT        255   ///< Maximum bytes in terminal output.\r
 #define NAME_MAX          255   ///< Maximum bytes in a file name.\r
 #ifndef OPEN_MAX\r
   #define OPEN_MAX         20   ///< Maximum open files per process.\r
index d8e15caa403b783aff09140040d9a765ddd9144b..b53ee24939570a4855c08ad38aa20ebfe9c0945a 100644 (file)
               - WEOF might not be negative.\r
               - mbstate_t objects are not intended to be inspected by programs.\r
 \r
-    Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+    Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
     This program and the accompanying materials are licensed and made available under\r
     the terms and conditions of the BSD License that accompanies this distribution.\r
     The full text of the license may be found at\r
@@ -913,7 +913,7 @@ wint_t fgetwc(FILE *Stream);
     @param[out] S         A pointer to the array to receive the input string.\r
     @param[in]  Limit     The maximum number of characters to put into Buff,\r
                           including the terminating null character.\r
-    @param[in]  Stream    An input stream from which to obtain a character.\r
+    @param[in]  Stream    An input stream from which to obtain the string.\r
 \r
     @return   The fgetws function returns S if successful. If end-of-file is\r
               encountered and no characters have been read into the array, the\r
@@ -1420,7 +1420,7 @@ int mbsinit(const mbstate_t *ps);
 **/\r
 size_t mbrlen(const char * __restrict S, size_t n, mbstate_t * __restrict ps);\r
 \r
-/**\r
+/** Restartable Multibyte to Wide character conversion.\r
 If S is a null pointer, the mbrtowc function is equivalent to the call:<BR>\r
 @verbatim\r
         mbrtowc(NULL, "", 1, ps)\r
@@ -1476,22 +1476,27 @@ to restore the initial shift state; the resulting state described is the initial
 **/\r
 size_t wcrtomb(char * __restrict S, wchar_t wc, mbstate_t * __restrict ps);\r
 \r
-/**\r
-The mbsrtowcs function converts a sequence of multibyte characters that begins in the\r
-conversion state described by the object pointed to by ps, from the array indirectly\r
-pointed to by src into a sequence of corresponding wide characters. If dst is not a null\r
-pointer, the converted characters are stored into the array pointed to by dst. Conversion\r
-continues up to and including a terminating null character, which is also stored.\r
-Conversion stops earlier in two cases: when a sequence of bytes is encountered that does\r
-not form a valid multibyte character, or (if dst is not a null pointer) when len wide\r
-characters have been stored into the array pointed to by dst. Each conversion takes\r
-place as if by a call to the mbrtowc function.\r
-\r
-If dst is not a null pointer, the pointer object pointed to by src is assigned either a null\r
-pointer (if conversion stopped due to reaching a terminating null character) or the address\r
-just past the last multibyte character converted (if any). If conversion stopped due to\r
-reaching a terminating null character and if dst is not a null pointer, the resulting state\r
-described is the initial conversion state.\r
+/** Convert a sequence of multibyte characters into a sequence of wide characters.\r
+    The mbsrtowcs function converts a sequence of multibyte characters that begins in the\r
+    conversion state described by the object pointed to by ps, from the array indirectly\r
+    pointed to by src into a sequence of corresponding wide characters. If dst is not a null\r
+    pointer, the converted characters are stored into the array pointed to by dst. Conversion\r
+    continues up to and including a terminating null character, which is also stored.\r
+    Conversion stops earlier in two cases: when a sequence of bytes is encountered that does\r
+    not form a valid multibyte character, or (if dst is not a null pointer) when len wide\r
+    characters have been stored into the array pointed to by dst. Each conversion takes\r
+    place as if by a call to the mbrtowc function.\r
+\r
+    If dst is not a null pointer, the pointer object pointed to by src is assigned either a null\r
+    pointer (if conversion stopped due to reaching a terminating null character) or the address\r
+    just past the last multibyte character converted (if any). If conversion stopped due to\r
+    reaching a terminating null character and if dst is not a null pointer, the resulting state\r
+    described is the initial conversion state.\r
+\r
+    @param[in]    dst   Destination for the Wide character sequence.\r
+    @param[in]    src   Pointer to Pointer to MBCS char. sequence to convert.\r
+    @param[in]    len   Length of dest, in WIDE characters.\r
+    @param[in]    ps    Pointer to the conversion state object to be used for this conversion.\r
 \r
     @return   If the input conversion encounters a sequence of bytes that do\r
               not form a valid multibyte character, an encoding error occurs:\r
@@ -1523,6 +1528,11 @@ size_t mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t
     terminating null wide character, the resulting state described is the\r
     initial conversion state.\r
 \r
+    @param[in]    dst   Destination for the MBCS sequence.\r
+    @param[in]    src   Pointer to Pointer to wide char. sequence to convert.\r
+    @param[in]    len   Length of dest, in bytes.\r
+    @param[in]    ps    Pointer to the conversion state object to be used for this conversion.\r
+\r
     @return     If conversion stops because a wide character is reached that\r
                 does not correspond to a valid multibyte character, an\r
                 encoding error occurs: the wcsrtombs function stores the\r
index 953e8f674a8f608edeb79ab0254fa1c6bd1e7e22..a69f022deea5ad2f490c396efa19f1bf4b228f29 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+    Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
     This program and the accompanying materials are licensed and made available\r
     under the terms and conditions of the BSD License that accompanies this\r
     distribution.  The full text of the license may be found at\r
@@ -41,9 +41,6 @@
     NetBSD: refill.c,v 1.13 2003/08/07 16:43:30 agc Exp\r
     refill.c  8.1 (Berkeley) 6/4/93\r
 */\r
-#include <Uefi.h>               // REMOVE, For DEBUG only\r
-#include <Library/UefiLib.h>    // REMOVE, For DEBUG only\r
-\r
 #include  <LibConfig.h>\r
 #include <sys/EfiCdefs.h>\r
 \r
@@ -93,28 +90,23 @@ __srefill(FILE *fp)
   if (!__sdidinit)\r
     __sinit();\r
 \r
-//Print(L"%a( %d)\n", __func__, fp->_file);\r
   fp->_r = 0;   /* largely a convenience for callers */\r
 \r
   /* SysV does not make this test; take it out for compatibility */\r
   if (fp->_flags & __SEOF) {\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
     return (EOF);\r
   }\r
 \r
   /* if not already reading, have to be reading and writing */\r
   if ((fp->_flags & __SRD) == 0) {\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
     if ((fp->_flags & __SRW) == 0) {\r
       errno = EBADF;\r
       fp->_flags |= __SERR;   //<dvm> Allows differentiation between errors and EOF\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
       return (EOF);\r
     }\r
     /* switch to reading */\r
     if (fp->_flags & __SWR) {\r
       if (__sflush(fp)) {\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
         return (EOF);\r
       }\r
       fp->_flags &= ~__SWR;\r
@@ -123,7 +115,6 @@ __srefill(FILE *fp)
     }\r
     fp->_flags |= __SRD;\r
   } else {\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
     /*\r
      * We were reading.  If there is an ungetc buffer,\r
      * we must have been reading from that.  Drop it,\r
@@ -134,7 +125,6 @@ __srefill(FILE *fp)
       FREEUB(fp);\r
       if ((fp->_r = fp->_ur) != 0) {\r
         fp->_p = fp->_up;\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
         return (0);\r
       }\r
     }\r
@@ -143,7 +133,6 @@ __srefill(FILE *fp)
   if (fp->_bf._base == NULL)\r
     __smakebuf(fp);\r
 \r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
   /*\r
    * Before reading from a line buffered or unbuffered file,\r
    * flush all line buffered output files, per the ANSI C\r
@@ -153,7 +142,6 @@ __srefill(FILE *fp)
     rwlock_rdlock(&__sfp_lock);\r
     (void) _fwalk(lflush);\r
     rwlock_unlock(&__sfp_lock);\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
   }\r
   fp->_p = fp->_bf._base;\r
   fp->_r = (*fp->_read)(fp->_cookie, (char *)fp->_p, fp->_bf._size);\r
@@ -165,9 +153,7 @@ __srefill(FILE *fp)
       fp->_r = 0;\r
       fp->_flags |= __SERR;\r
     }\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
     return (EOF);\r
   }\r
-//Print(L"%a: %d\n", __func__, __LINE__);\r
   return (0);\r
 }\r
index 6e7d1b4c79821d72119ae70566a9f59832f97939..6312895c40449b23cd8d5497353954716cf77567 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The EFI kernel's interpretation of a "file".\r
 \r
-  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available\r
   under the terms and conditions of the BSD License which accompanies this\r
   distribution.  The full text of the license may be found at\r
@@ -82,8 +82,16 @@ struct _Device_Node;
 struct __filedes {\r
   off_t                   f_offset;     /* current position in file */\r
   const struct fileops   *f_ops;\r
+\r
+  /*  The devdata member has different meanings depending upon whether\r
+      a block oriented or character oriented device is being accessed.\r
+      For block devices, devdata holds an EFI handle to the open file or directory.\r
+      For character devices, devdata points to the device's IIO structure,\r
+      if it has one.  It may be NULL indicating a non-interactive character\r
+      device.\r
+  */\r
   void                   *devdata;      /* Device-specific data */\r
-  int                     Oflags;       // From the open call\r
+  int                     Oflags;       // From the open call, see fcntl.h\r
   int                     Omode;        // From the open call\r
   int                     RefCount;     // Reference count of opens\r
   UINT32                  f_flag;       /* see fcntl.h */\r