37 lines
628 B
C
37 lines
628 B
C
![]() |
#ifndef _FILE_H_
|
||
|
#define _FILE_H_
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <fcntl.h>
|
||
|
#include <unistd.h>
|
||
|
#include <pthread.h>
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C"
|
||
|
{
|
||
|
#endif
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
char filepath[128];
|
||
|
int32_t flag;
|
||
|
mode_t mode;
|
||
|
int32_t fd;
|
||
|
pthread_mutex_t mutex;
|
||
|
} file_t;
|
||
|
|
||
|
int32_t osp_file_init(file_t *file);
|
||
|
|
||
|
int32_t osp_file_read(char *buffer, int32_t size, file_t *file);
|
||
|
|
||
|
int32_t osp_file_write(file_t *file, char *buffer, int32_t size);
|
||
|
int32_t osp_mkdirs(char *path, mode_t mode);
|
||
|
int32_t osp_get_file_path(char *name, char *path);
|
||
|
int32_t osp_file_is_exist(char *file);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif
|