VirtualBox

Changeset 86579 in vbox


Ignore:
Timestamp:
Oct 14, 2020 8:53:56 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
140939
Message:

IPRT/sysfs.h: Added RTLinuxConstructPath and RTLinuxConstructPathV. bugref:9224

Location:
trunk
Files:
3 edited

Legend:

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

    r82968 r86579  
    446446                                   const char *pszPattern, ...) RT_IPRT_FORMAT_ATTR(5, 6);
    447447
     448/**
     449 * Constructs the path of a sysfs file from the format parameters passed,
     450 * prepending "/sys/" if the path is relative.
     451 *
     452 * @returns IPRT status code.
     453 * @param   pszPath    Where to write the path.
     454 * @param   cbPath     The size of the buffer pointed to by @a pszPath.
     455 * @param   pszFormat  The name format, either absolute or relative to "/sys/".
     456 * @param   va         The format args.
     457 */
     458RTDECL(int) RTLinuxConstructPathV(char *pszPath, size_t cbPath, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
     459
     460/**
     461 * Constructs the path of a sysfs file from the format parameters passed,
     462 * prepending "/sys/" if the path is relative.
     463 *
     464 * @returns IPRT status code.
     465 * @param   pszPath    Where to write the path.
     466 * @param   cbPath     The size of the buffer pointed to by @a pszPath.
     467 * @param   pszFormat  The name format, either absolute or relative to "/sys/".
     468 * @param   ...        The format args.
     469 */
     470RTDECL(int) RTLinuxConstructPath(char *pszPath, size_t cbPath, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
     471
    448472/** @} */
    449473
  • trunk/include/iprt/mangling.h

    r86412 r86579  
    12801280# define RTLinuxCheckDevicePath                         RT_MANGLER(RTLinuxCheckDevicePath)
    12811281# define RTLinuxCheckDevicePathV                        RT_MANGLER(RTLinuxCheckDevicePathV)
     1282# define RTLinuxConstructPath                           RT_MANGLER(RTLinuxConstructPath)
     1283# define RTLinuxConstructPathV                          RT_MANGLER(RTLinuxConstructPathV)
    12821284# define RTLinuxSysFsClose                              RT_MANGLER(RTLinuxSysFsClose)
    12831285# define RTLinuxSysFsExists                             RT_MANGLER(RTLinuxSysFsExists)
  • trunk/src/VBox/Runtime/r3/linux/sysfs.cpp

    r84681 r86579  
    125125{
    126126    return rtLinuxConstructPathV(pszBuf, cchBuf, "/sys/", pszFormat, va);
     127}
     128
     129
     130RTDECL(int) RTLinuxConstructPathV(char *pszPath, size_t cbPath, const char *pszFormat, va_list va)
     131{
     132    return rtLinuxSysFsConstructPath(pszPath, cbPath, pszFormat, va);
     133}
     134
     135
     136RTDECL(int) RTLinuxConstructPath(char *pszPath, size_t cbPath, const char *pszFormat, ...)
     137{
     138    va_list va;
     139    va_start(va, pszFormat);
     140    int rc = rtLinuxSysFsConstructPath(pszPath, cbPath, pszFormat, va);
     141    va_end(va);
     142    return rc;
    127143}
    128144
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