32#include <sys/statfs.h>
36#ifdef LOSCFG_KERNEL_PM
86 if (strcmp(buf,
"normal") == 0) {
88 }
else if (strcmp(buf,
"light") == 0) {
90 }
else if (strcmp(buf,
"deep") == 0) {
92 }
else if (strcmp(buf,
"shutdown") == 0) {
95 PRINT_ERR(
"Unsupported hibernation mode: %s\n", buf);
136 weakCount = atoi(buf);
145#define POWER_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
146#define OS_POWER_PRIVILEGE 7
152 PRINT_ERR(
"create /proc/power error!\n");
155 power->
uid = OS_POWER_PRIVILEGE;
156 power->
gid = OS_POWER_PRIVILEGE;
160 PRINT_ERR(
"create /proc/power/power_mode error!\n");
164 mode->uid = OS_POWER_PRIVILEGE;
165 mode->gid = OS_POWER_PRIVILEGE;
169 PRINT_ERR(
"create /proc/power/power_lock error!\n");
173 lock->
uid = OS_POWER_PRIVILEGE;
174 lock->
gid = OS_POWER_PRIVILEGE;
177 if (unlock == NULL) {
178 PRINT_ERR(
"create /proc/power/power_unlock error!\n");
182 unlock->
uid = OS_POWER_PRIVILEGE;
183 unlock->
gid = OS_POWER_PRIVILEGE;
187 PRINT_ERR(
"create /proc/power/power_count error!\n");
191 count->uid = OS_POWER_PRIVILEGE;
192 count->gid = OS_POWER_PRIVILEGE;
void ProcFreeEntry(struct ProcDirEntry *pde)
释放
UINT32 LOS_PmModeSet(LOS_SysSleepEnum mode)
Set low power mode.
VOID LOS_PmLockInfoShow(struct SeqBuf *m)
显示所有电源锁信息
UINT32 LOS_PmReadLock(VOID)
Gets the current PM lock status.
UINT32 LOS_PmLockRequest(const CHAR *name)
Request to obtain the lock in current mode, so that the system will not enter this mode when it enter...
UINT32 LOS_PmSuspend(UINT32 wakeCount)
The system enters the low-power flow.
UINT32 LOS_PmLockRelease(const CHAR *name)
Release the lock in current mode so that the next time the system enters the idle task,...
int LosBufPrintf(struct SeqBuf *seqBuf, const char *fmt,...)
支持可变参数 写 buf
static int PowerCountWrite(struct ProcFile *pf, const char *buf, size_t count, loff_t *ppos)
static int PowerCountRead(struct SeqBuf *m, void *v)
static const struct ProcFileOperations PowerLock
proc 拿电源锁操作
static int PowerLockWrite(struct ProcFile *pf, const char *buf, size_t count, loff_t *ppos)
static int PowerModeRead(struct SeqBuf *m, void *v)
static int PowerModeWrite(struct ProcFile *pf, const char *buf, size_t count, loff_t *ppos)
static int PowerLockRead(struct SeqBuf *m, void *v)
读取电源锁信息
static const struct ProcFileOperations PowerUnlock
static const struct ProcFileOperations PowerMode
static int PowerUnlockWrite(struct ProcFile *pf, const char *buf, size_t count, loff_t *ppos)
static const struct ProcFileOperations PowerCount
struct ProcDirEntry * CreateProcEntry(const char *name, mode_t mode, struct ProcDirEntry *parent)
create a proc node
proc 目录/文件项, @notethinking 直接叫 ProcEntry不香吗 ? 操作 /proc的 真正结构体
const struct ProcFileOperations * procFileOps
驱动程序,每个 /proc 下目录的驱动程序都不一样
真正最后能操作pro file的接口,proc本质是个内存文件系统, vfs - > ProcFileOperations
ssize_t(* write)(struct ProcFile *pf, const char *buf, size_t count, loff_t *ppos)
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 void