You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.5 KiB

/*
* Copyright (c) @Hisilicon Technologies Co., Ltd. 2020. All rights reserved.
*/
#ifndef __MACH_UTIL_H__
#define __MACH_UTIL_H__
#include <linux/version.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/sysctl.h>
#include <mntn/platform/mntn_public_interface.h>
#define PBUF_MAXSIZE (128)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
typedef struct proc_ops mntn_proc_ops;
#define MNTN_PROC_OPEN proc_open
#define MNTN_PROC_READ proc_read
#define MNTN_PROC_WRITE proc_write
#define MNTN_PROC_LSEEK proc_lseek
#define MNTN_PROC_RELEASE proc_release
#else
typedef struct file_operations mntn_proc_ops;
#define MNTN_PROC_OPEN open
#define MNTN_PROC_READ read
#define MNTN_PROC_WRITE write
#define MNTN_PROC_LSEEK llseek
#define MNTN_PROC_RELEASE release
#endif
#ifdef CONFIG_PLATFORM_MAINTAIN
int check_mntnctl(int feature);
#else
static inline int check_mntnctl(int feature)
{
return 0;
}
#endif
u32 mntn_atoi(char *s, int len);
struct proc_dir_entry *mntn_create_root_proc_dir(const char *name);
struct proc_dir_entry *mntn_create_root_proc_entry(const char *name, mode_t mode,
const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_root_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_stats_proc_entry(const char *name, mode_t mode,
const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_stats_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_memory_proc_entry(const char *name, mode_t mode,
const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_memory_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_log_proc_entry(const char *name, mode_t mode,
const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_log_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_pstore_proc_entry(const char *name, mode_t mode,
const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_pstore_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_extend_proc_entry(const char *name,
mode_t mode, const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_extend_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_platform_proc_entry(const char *name,
mode_t mode, const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_platform_proc_entry(const char *name);
struct proc_dir_entry *mntn_create_mntnctl_proc_entry(const char *name,
mode_t mode, const mntn_proc_ops *proc_fops, void *data);
void mntn_remove_mntnctl_proc_entry(const char *name);
#endif