fs

fs — Helpers for file operations

Functions

Includes

#include <igt_fs.h>

Description

This library provides helpers for file operations

Functions

igt_fs_create_dir ()

int
igt_fs_create_dir (int fd,
                   const char *name,
                   mode_t mode);

igt_fs_remove_dir ()

int
igt_fs_remove_dir (int fd,
                   const char *name);

igt_readn ()

ssize_t
igt_readn (int fd,
           char *buf,
           size_t len);

Read from fd into provided buffer until the buffer is full or EOF

Parameters

fd

the file descriptor

 

buf

buffer where the contents will be stored, allocated by the caller

 

size

size of the buffer

 

Returns

-errno on failure or bytes read on success


igt_writen ()

ssize_t
igt_writen (int fd,
            const char *buf,
            size_t len);

This writes len bytes from data to the sysfs file.

Parameters

fd

the file descriptor

 

buf

the block with the contents to write

 

len

the length to write

 

Returns

-errno on failure or bytes written on success

Types and Values