vfs_jffs2.h 2.0 KB
Newer Older
J
j00316535 已提交
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 52 53 54 55 56 57 58 59 60 61 62 63
/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */
#ifndef __DFS_JFFS2_H__
#define __DFS_JFFS2_H__

#include "mtd_partition.h"
#include "os-ecos.h"
#include "fileio.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */

#ifndef NOR_FLASH_BOOT_SIZE
#define NOR_FLASH_BOOT_SIZE 0x100000
#endif

#define JFFS_WAITING_FOREVER              -1    /* Block forever until get resource. */


struct los_jffs2_operations {
    int (*mount)    (cyg_mtab_entry *mte, int partition_num);
    int (*stat)     (cyg_mtab_entry *mte, const char *name, struct jffs2_stat *buf);
    int (*open)     (cyg_mtab_entry *mte, const char *name, int flags,
                    int mode,  cyg_file *fte);
    int (*close)    (struct CYG_FILE_TAG *fp);
    int (*read)     (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
    int (*write)    (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
    int (*lseek)    (struct CYG_FILE_TAG *fp, off_t *apos, int whence);
    int (*opendir)  (cyg_mtab_entry *mte, const char *name, cyg_file *fte);
    int (*mkdir)    (cyg_mtab_entry *mte, const char *name, int mode);
    int (*rmdir)    (cyg_mtab_entry *mte, const char *name);
    int (*unlink)   (cyg_mtab_entry *mte, const char *name);
    int (*rename)   (cyg_mtab_entry *mte, const char *name1, const char *name2);
    int (*readdir)  (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
    int (*lseekdir) (struct CYG_FILE_TAG *fp, off_t *pos, int whence);
    int (*umount)   (cyg_mtab_entry *mte);
    int (*chattr)   (cyg_mtab_entry *mte, const char *name, iattr *attr);
};

extern struct los_jffs2_operations jffs2_fs_type;
extern struct los_jffs2_operations jffs2_file_operations;
extern struct los_jffs2_operations jffs2_dir_operations;
extern struct los_jffs2_operations jffs2_dir_inode_operations;

int JffsMutexCreate(void);
void JffsMutexDelete(void);

#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

#endif