-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpack_fat.h
55 lines (46 loc) · 1.23 KB
/
pack_fat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <iostream>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <cstring>
#include <string>
#include <time.h>
#include <memory>
#include <cstdlib>
#include <stdio.h>
#if defined(_WIN32)
#include <io.h>
#endif
#include <dirent.h>
#include "esp_vfs_fat.h"
#include "user_vfs.h"
#include "esp_err.h"
#include "esp_log.h"
#include "FatPartition.h"
/**
* @brief This class is used to pack/upack filesystem.
*
*/
class Pack_fat
{
public:
Pack_fat();
~Pack_fat();
int actionPack(std::string s_dirName, std::string s_imageName, int s_imageSize);
int actionUnpack(std::string s_imageName, std::string s_dirName,int s_imageSize);
private:
bool fsMount(int s_imageSize);
bool fsUnmount();
size_t getFileSize(FILE* fp);
bool dirExists(const char* path);
bool dirCreate(const char* path);
int parkDirToRamFS(const char* name);
int parkFileToRamFS(char* path_src, const char* path_des);
bool parkFilesToRamFS(const char* dirSrc, const char* dirDes);
int unparkFileFromRamFS(const char* path_src, const char* path_des);
bool unparkFilesFromRamFS(const char* dirSrc, const char* dirDes);
protected:
};