1 /* 2 * Copyright (C) 2015-2017 Alibaba Group Holding Limited 3 */ 4 5 #ifndef VFS_ADAPT_H 6 #define VFS_ADAPT_H 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** 13 * @brief Create OS lock 14 * 15 * @return the pointer of the lock 16 * 17 */ 18 void *vfs_lock_create(void); 19 20 /** 21 * @brief Free OS lock 22 * 23 * @param[in] lock pointer to the os lock 24 * 25 * @return 0 on success, negative error on failure 26 * 27 */ 28 int32_t vfs_lock_free(void *lock); 29 30 /** 31 * @brief Lock the os lock 32 * 33 * @param[in] lock pointer to the os lock 34 * 35 * @return 0 on success, negative error on failure 36 * 37 */ 38 int32_t vfs_lock(void *lock); 39 40 /** 41 * @brief Unlock the os lock 42 * 43 * @param[in] lock pointer to the os lock 44 * 45 * @return 0 on success, negative error on failure 46 * 47 */ 48 int32_t vfs_unlock(void *lock); 49 50 /** 51 * @brief wrapper of MM allocation 52 * 53 * @param[in] size size of the mem to alloc 54 * 55 * @return NULL is error, other is memory address 56 * 57 */ 58 void *vfs_malloc(uint32_t size); 59 60 /** 61 * @brief wrapper of MM free 62 * 63 * @param[in] ptr address point of the mem 64 * 65 */ 66 void vfs_free(void *ptr); 67 68 #ifdef __cplusplus 69 } 70 #endif 71 72 #endif /* VFS_ADAPT_H */ 73