universal7885: Fix clang-tidy issue again

This commit is contained in:
roynatech2544 2022-05-21 12:58:03 +00:00
commit 988595370b
9 changed files with 32 additions and 32 deletions

View file

@ -22,7 +22,7 @@ static int mSwapSize = 100;
extern int mkswap (std::string filename);
extern void mkfile(int filesize, std::string name);
#define SWAP_PATH "/data/swap/swapfile"
static std::string SWAP_PATH = "/data/swap/swapfile";
namespace vendor::eureka::hardware::parts::V1_0 {
@ -34,13 +34,13 @@ Return<void> SwapOnData::setSwapSize(int32_t size) {
Return<void> SwapOnData::setSwapOn() {
mkfile(mSwapSize * 1024 * 1024 * 10, SWAP_PATH);
mkswap(SWAP_PATH);
swapon(SWAP_PATH, (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
swapon(SWAP_PATH.c_str(), (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
return Void();
}
Return<void> SwapOnData::setSwapOff() {
swapoff(SWAP_PATH);
remove(SWAP_PATH);
swapoff(SWAP_PATH.c_str());
remove(SWAP_PATH.c_str());
return Void();
}

View file

@ -18,7 +18,7 @@ struct linux_swap_header {
u_int32_t padding[117];
u_int32_t badpages[1];
};
void mkfile(const int filesize, const std::string& name){
void mkfile(int filesize, std::string name){
FILE *fp = fopen(name.c_str(), "we");
fseek(fp, filesize , SEEK_SET);
fputc('\0', fp);
@ -27,7 +27,7 @@ void mkfile(const int filesize, const std::string& name){
#define MAGIC_SWAP_HEADER "SWAPSPACE2"
#define MAGIC_SWAP_HEADER_LEN 10
#define MIN_PAGES 10
int mkswap(const std::string& filename) {
int mkswap(std::string filename) {
int err = 0;
int fd;
ssize_t len;