Changeset 60390 in vbox for trunk/include/iprt/linux
- Timestamp:
- Apr 8, 2016 9:17:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/linux/sysfs.h
r60373 r60390 84 84 85 85 /** 86 * Opens a sysfs file for reading. 87 * 88 * @returns IPRT status code. 89 * @param phFile Where to store the file handle on success. 90 * @param pszFormat The name format, either absolute or relative to "/sys/". 91 * @param va The format args. 92 * 93 * @note Close the file using RTFileClose(). 94 */ 95 RTDECL(int) RTLinuxSysFsOpenV(PRTFILE phFile, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0); 96 97 /** 98 * Opens a sysfs file - extended version. 99 * 100 * @returns IPRT status code. 101 * @param phFile Where to store the file handle on success. 102 * @param fOpen Open flags, see RTFileOpen(). 103 * @param pszFormat The name format, either absolute or relative to "/sys/". 104 * @param va The format args. 105 */ 106 RTDECL(int) RTLinuxSysFsOpenExV(PRTFILE phFile, uint64_t fOpen, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0); 107 108 /** 86 109 * Opens a sysfs file. 87 110 * … … 89 112 * @param phFile Where to store the file handle on success. 90 113 * @param pszFormat The name format, either absolute or relative to "/sys/". 91 * @param vaThe format args.114 * @param ... The format args. 92 115 * 93 116 * @note Close the file using RTFileClose(). 94 117 */ 95 RTDECL(int) RTLinuxSysFsOpen V(PRTFILE phFile, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);96 97 /** 98 * Opens a sysfs file .118 RTDECL(int) RTLinuxSysFsOpen(PRTFILE phFile, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3); 119 120 /** 121 * Opens a sysfs file - extended version. 99 122 * 100 123 * @returns IPRT status code. 101 124 * @param phFile Where to store the file handle on success. 125 * @param fOpen Open flags, see RTFileOpen(). 102 126 * @param pszFormat The name format, either absolute or relative to "/sys/". 103 127 * @param ... The format args. 104 * 105 * @note Close the file using RTFileClose(). 106 */ 107 RTDECL(int) RTLinuxSysFsOpen(PRTFILE phFile, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 128 */ 129 RTDECL(int) RTLinuxSysFsOpenEx(PRTFILE phFile, uint64_t fOpen, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 108 130 109 131 /** … … 119 141 120 142 /** 143 * Writes a string to a file opened with RTLinuxSysFsOpenEx or RTLinuxSysFsOpenExV for writing. 144 * 145 * @returns IPRT status code. 146 * @param hFile The file descriptor returned by RTLinuxSysFsOpenEx or RTLinuxSysFsOpenExV. 147 * @param pszBuf The string to write. 148 * @param cchBuf The string length without zero terminator - if 0 is given 149 * the string length is determined before writing. 150 * @param pcchWritten Where to store the amount of characters written on success - optional. 151 */ 152 RTDECL(int) RTLinuxSysFsWriteStr(RTFILE hFile, const char *pszBuf, size_t cchBuf, size_t *pcchWritten); 153 154 /** 121 155 * Reads the remainder of a file opened with RTLinuxSysFsOpen or 122 156 * RTLinuxSysFsOpenV. … … 131 165 132 166 /** 167 * Writes the given buffer to a file opened with RTLinuxSysFsOpenEx or 168 * RTLinuxSysFsOpenExV. 169 * 170 * @returns IPRT status code. 171 * @param hFile The file descriptor returned by RTLinuxSysFsOpenEx or RTLinuxSysFsOpenExV. 172 * @param pvBuf The data to write. 173 * @param cbBuf The size of the buffer. 174 * @param pcbWritten Where to return the number of bytes read. Optional. 175 */ 176 RTDECL(int) RTLinuxSysFsWriteFile(RTFILE hFile, void *pvBuf, size_t cbBuf, size_t *pcbWritten); 177 178 /** 133 179 * Reads a number from a sysfs file. 134 180 * … … 139 185 * @param va Format args. 140 186 */ 141 RTDECL(int) RTLinuxSysFsReadIntFileV(unsigned uBase, int64_t *pi64, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR( 2, 0);187 RTDECL(int) RTLinuxSysFsReadIntFileV(unsigned uBase, int64_t *pi64, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0); 142 188 143 189 /** … … 150 196 * @param ... Format args. 151 197 */ 152 RTDECL(int) RTLinuxSysFsReadIntFile(unsigned uBase, int64_t *pi64, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3); 198 RTDECL(int) RTLinuxSysFsReadIntFile(unsigned uBase, int64_t *pi64, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 199 200 /** 201 * Writes an unsigned 8-bit number to a sysfs file. 202 * 203 * @returns IPRT status code. 204 * @param uBase The base format to write the number. Passing 16 here for 205 * example writes the number as a hexadecimal string with 0x prepended. 206 * @param u8 The number to write. 207 * @param pszFormat The filename format, either absolute or relative to "/sys/". 208 * @param va Format args. 209 */ 210 RTDECL(int) RTLinuxSysFsWriteU8FileV(unsigned uBase, uint8_t u8, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0); 211 212 /** 213 * Writes an unsigned 8-bit number to a sysfs file. 214 * 215 * @returns IPRT status code. 216 * @param uBase The base format to write the number. Passing 16 here for 217 * example writes the number as a hexadecimal string with 0x prepended. 218 * @param u8 The number to write. 219 * @param pszFormat The filename format, either absolute or relative to "/sys/". 220 * @param ... Format args. 221 */ 222 RTDECL(int) RTLinuxSysFsWriteU8File(unsigned uBase, uint8_t u8, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 223 224 /** 225 * Writes an unsigned 16-bit number to a sysfs file. 226 * 227 * @returns IPRT status code. 228 * @param uBase The base format to write the number. Passing 16 here for 229 * example writes the number as a hexadecimal string with 0x prepended. 230 * @param u16 The number to write. 231 * @param pszFormat The filename format, either absolute or relative to "/sys/". 232 * @param va Format args. 233 */ 234 RTDECL(int) RTLinuxSysFsWriteU16FileV(unsigned uBase, uint16_t u16, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0); 235 236 /** 237 * Writes an unsigned 16-bit number to a sysfs file. 238 * 239 * @returns IPRT status code. 240 * @param uBase The base format to write the number. Passing 16 here for 241 * example writes the number as a hexadecimal string with 0x prepended. 242 * @param u16 The number to write. 243 * @param pszFormat The filename format, either absolute or relative to "/sys/". 244 * @param ... Format args. 245 */ 246 RTDECL(int) RTLinuxSysFsWriteU16File(unsigned uBase, uint16_t u16, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 247 248 /** 249 * Writes an unsigned 32-bit number to a sysfs file. 250 * 251 * @returns IPRT status code. 252 * @param uBase The base format to write the number. Passing 16 here for 253 * example writes the number as a hexadecimal string with 0x prepended. 254 * @param u32 The number to write. 255 * @param pszFormat The filename format, either absolute or relative to "/sys/". 256 * @param va Format args. 257 */ 258 RTDECL(int) RTLinuxSysFsWriteU32FileV(unsigned uBase, uint32_t u32, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0); 259 260 /** 261 * Writes an unsigned 8-bit number to a sysfs file. 262 * 263 * @returns IPRT status code. 264 * @param uBase The base format to write the number. Passing 16 here for 265 * example writes the number as a hexadecimal string with 0x prepended. 266 * @param u32 The number to write. 267 * @param pszFormat The filename format, either absolute or relative to "/sys/". 268 * @param ... Format args. 269 */ 270 RTDECL(int) RTLinuxSysFsWriteU32File(unsigned uBase, uint32_t u32, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 271 272 /** 273 * Writes an unsigned 64-bit number to a sysfs file. 274 * 275 * @returns IPRT status code. 276 * @param uBase The base format to write the number. Passing 16 here for 277 * example writes the number as a hexadecimal string with 0x prepended. 278 * @param u64 The number to write. 279 * @param pszFormat The filename format, either absolute or relative to "/sys/". 280 * @param va Format args. 281 */ 282 RTDECL(int) RTLinuxSysFsWriteU64FileV(unsigned uBase, uint64_t u64, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0); 283 284 /** 285 * Writes an unsigned 8-bit number to a sysfs file. 286 * 287 * @returns IPRT status code. 288 * @param uBase The base format to write the number. Passing 16 here for 289 * example writes the number as a hexadecimal string with 0x prepended. 290 * @param u64 The number to write. 291 * @param pszFormat The filename format, either absolute or relative to "/sys/". 292 * @param ... Format args. 293 */ 294 RTDECL(int) RTLinuxSysFsWriteU64File(unsigned uBase, uint32_t u64, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 153 295 154 296 /** … … 160 302 * @param va Format args. 161 303 */ 162 RTDECL(int) RTLinuxSysFsReadDevNumFileV(dev_t *pDevNum, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR( 1, 0);304 RTDECL(int) RTLinuxSysFsReadDevNumFileV(dev_t *pDevNum, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0); 163 305 164 306 /** … … 170 312 * @param ... Format args. 171 313 */ 172 RTDECL(int) RTLinuxSysFsReadDevNumFile(dev_t *pDevNum, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR( 1, 2);314 RTDECL(int) RTLinuxSysFsReadDevNumFile(dev_t *pDevNum, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3); 173 315 174 316 /** … … 184 326 * @param va Format args. 185 327 */ 186 RTDECL(int) RTLinuxSysFsReadStrFileV(char *pszBuf, size_t cchBuf, size_t *pcchRead, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR( 3, 0);328 RTDECL(int) RTLinuxSysFsReadStrFileV(char *pszBuf, size_t cchBuf, size_t *pcchRead, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0); 187 329 188 330 /** … … 198 340 * @param ... Format args. 199 341 */ 200 RTDECL(int) RTLinuxSysFsReadStrFile(char *pszBuf, size_t cchBuf, size_t *pcchRead, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4); 342 RTDECL(int) RTLinuxSysFsReadStrFile(char *pszBuf, size_t cchBuf, size_t *pcchRead, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5); 343 344 /** 345 * Writes a string to a sysfs file. 346 * 347 * @returns IPRT status code. 348 * @param pszBuf The string to write. 349 * @param cchBuf The size of the buffer pointed to by @a pszBuf. 350 * @param pcchWritten Where to store the amount of characters written on success - optional. 351 * @param pszFormat The filename format, either absolute or relative to "/sys/". 352 * @param va Format args. 353 */ 354 RTDECL(int) RTLinuxSysFsWriteStrFileV(const char *pszBuf, size_t cchBuf, size_t *pcchWritten, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0); 355 356 /** 357 * Writes a string to a sysfs file. 358 * 359 * @returns IPRT status code. 360 * @param pszBuf The string to write. 361 * @param cchBuf The size of the buffer pointed to by @a pszBuf. 362 * @param pcchWritten Where to store the amount of characters written on success - optional. 363 * @param pszFormat The filename format, either absolute or relative to "/sys/". 364 * @param ... Format args. 365 */ 366 RTDECL(int) RTLinuxSysFsReadStrFile(char *pszBuf, size_t cchBuf, size_t *pcchWritten, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5); 201 367 202 368 /** … … 216 382 * @param va Format args. 217 383 */ 218 RTDECL(int) RTLinuxSysFsGetLinkDestV(char *pszBuf, size_t cchBuf, size_t *pchBuf, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR( 3, 0);384 RTDECL(int) RTLinuxSysFsGetLinkDestV(char *pszBuf, size_t cchBuf, size_t *pchBuf, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0); 219 385 220 386 /** … … 234 400 * @param ... Format args. 235 401 */ 236 RTDECL(int) RTLinuxSysFsGetLinkDest(char *pszBuf, size_t cchBuf, size_t *pchBuf, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR( 3, 4);402 RTDECL(int) RTLinuxSysFsGetLinkDest(char *pszBuf, size_t cchBuf, size_t *pchBuf, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5); 237 403 238 404 /**
Note:
See TracChangeset
for help on using the changeset viewer.