VirtualBox

Changeset 23332 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Sep 25, 2009 1:26:57 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52844
Message:

iprt/linux/sysfs.h/cpp: code review, fixing RTLinuxSysFsGetLinkDest[V] termination issue, use RTPathAppend as rtLinuxConstructPath[V] isn't entirely safe, RTLinuxFindDevicePath[V] return value clearification, code style cleanups. Untested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/linux/sysfs.h

    r23309 r23332  
    3636#include <iprt/stdarg.h>
    3737
    38 #include <sys/types.h>
     38#include <sys/types.h> /* for dev_t */
    3939
    4040RT_C_DECLS_BEGIN
     
    171171 * directory.
    172172 *
    173  * @returns The number of characters written on success, -1 and errno on failure.
     173 * @returns The length of the returned string on success, -1 and errno on
     174 *          failure.
    174175 * @param   pszBuf      Where to store the path element.  Must be at least two
    175176 *                      characters, but a longer buffer would be advisable.
     
    188189 * directory.
    189190 *
    190  * @returns The number of characters written on success, -1 and errno on failure.
     191 * @returns The length of the returned string on success, -1 and errno on
     192 *          failure.
    191193 * @param   pszBuf      Where to store the path element.  Must be at least two
    192194 *                      characters, but a longer buffer would be advisable.
     
    198200
    199201/**
    200  * Find the path of a device node under /dev, given then device number.  This
    201  * function will recursively search under /dev until it finds a device node
     202 * Find the path of a device node under /dev, given then device number.
     203 *
     204 * This function will recursively search under /dev until it finds a device node
    202205 * matching @a devnum, and store the path into @a pszBuf.  The caller may
    203206 * provide an expected path in pszSuggestion, which will be tried before
    204207 * searching, but due to the variance in Linux systems it can be hard to always
    205208 * correctly predict the path.
    206  *
    207  * @returns the number of characters written on success, -1 and errno on
    208  *          failure
    209  * @returns -1 and ENOENT if no matching device node could be found
    210  * @param  devNum         the device number to search for
    211  * @param  fMode          the type of device - only RTFS_TYPE_DEV_CHAR
    212  *                        and RTFS_TYPE_DEV_BLOCK are valid values
    213  * @param  pszBuf         where to store the path
    214  * @param  cchBuf         the size of the buffer
    215  * @param  pszSuggestion  the expected path format of the device node, either
    216  *                        absolute or relative to "/dev" (optional)
    217  * @param  va             Format args.
    218  */
    219 RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t devNum, RTFMODE fMode, char *pszBuf, size_t cchBuf, const char *pszSuggestion, va_list va);
    220 
    221 /**
    222  * Find the path of a device node under /dev, given then device number.  This
    223  * function will recursively search under /dev until it finds a device node
     209 *
     210 * @returns The length of the returned string on success, -1 and errno on
     211 *          failure.
     212 * @returns -1 and ENOENT if no matching device node could be found.
     213 * @param   DevNum         The device number to search for.
     214 * @param   fMode          The type of device - only RTFS_TYPE_DEV_CHAR and
     215 *                         RTFS_TYPE_DEV_BLOCK are valid values.
     216 * @param   pszBuf         Where to store the path.
     217 * @param   cchBuf         The size of the buffer.
     218 * @param   pszSuggestion  The expected path format of the device node, either
     219 *                         absolute or relative to "/dev". (Optional)
     220 * @param   va             Format args.
     221 */
     222RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf, size_t cchBuf,
     223                                       const char *pszSuggestion, va_list va);
     224
     225/**
     226 * Find the path of a device node under /dev, given the device number.
     227 *
     228 * This function will recursively search under /dev until it finds a device node
    224229 * matching @a devnum, and store the path into @a pszBuf.  The caller may
    225230 * provide an expected path in pszSuggestion, which will be tried before
    226231 * searching, but due to the variance in Linux systems it can be hard to always
    227232 * correctly predict the path.
    228  *
    229  * @returns the number of characters written on success, -1 and errno on
    230  *          failure
    231  * @returns -1 and ENOENT if no matching device node could be found
    232  * @param  devNum         the device number to search for
    233  * @param  fMode          the type of device - only RTFS_TYPE_DEV_CHAR
    234  *                        and RTFS_TYPE_DEV_BLOCK are valid values
    235  * @param  pszBuf         where to store the path
    236  * @param  cchBuf         the size of the buffer
    237  * @param  pszSuggestion  the expected path format of the device node, either
    238  *                        absolute or relative to "/dev" (optional)
    239  * @param  ...            Format args.
    240  */
    241 RTDECL(ssize_t) RTLinuxFindDevicePath(dev_t devNum, RTFMODE fMode, char *pszBuf, size_t cchBuf, const char *pszSuggestion, ...);
     233 *
     234 * @returns The length of the returned string on success, -1 and errno on
     235 *          failure.
     236 * @returns -1 and ENOENT if no matching device node could be found.
     237 * @param   DevNum          The device number to search for
     238 * @param   fMode           The type of device - only RTFS_TYPE_DEV_CHAR and
     239 *                          RTFS_TYPE_DEV_BLOCK are valid values
     240 * @param   pszBuf          Where to store the path.
     241 * @param   cchBuf          The size of the buffer.
     242 * @param   pszSuggestion   The expected path format of the device node, either
     243 *                          absolute or relative to "/dev". (Optional)
     244 * @param   ...             Format args.
     245 */
     246RTDECL(ssize_t) RTLinuxFindDevicePath(dev_t DevNum, RTFMODE fMode, char *pszBuf, size_t cchBuf,
     247                                      const char *pszSuggestion, ...);
    242248
    243249/** @} */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette