fix(sdk): add cfs_IsDir,cfs_IsRegular for libsdk.

Signed-off-by: baihailong <baihailong@oppo.com>
This commit is contained in:
baihailong 2024-06-07 01:12:20 -07:00 committed by longerfly
parent 6aca325797
commit f08ff32bff
2 changed files with 20 additions and 0 deletions

View File

@ -155,6 +155,8 @@ extern int cfs_unlock_dir(int64_t id, char *path);
extern int cfs_get_dir_lock(int64_t id, char *path, int64_t *lock_id, char **valid_time);
extern int cfs_symlink(int64_t id, char *src_path, char *dst_path);
extern int cfs_link(int64_t id, char *src_path, char *dst_path);
extern char cfs_IsDir(mode_t mode);
extern char cfs_IsRegular(mode_t mode);
#ifdef __cplusplus
}

View File

@ -256,6 +256,24 @@ type client struct {
mu sync.Mutex
}
//export cfs_IsDir
func cfs_IsDir(mode C.mode_t) C.char {
var isDir uint8 = 0
if (mode & C.S_IFMT) == C.S_IFDIR {
isDir = 1
}
return C.char(isDir)
}
//export cfs_IsRegular
func cfs_IsRegular(mode C.mode_t) C.char {
var isRegular uint8 = 0
if (mode & C.S_IFMT) == C.S_IFREG {
isRegular = 1
}
return C.char(isRegular)
}
//export cfs_symlink
func cfs_symlink(id C.int64_t, src_path *C.char, dst_path *C.char) C.int {
c, exist := getClient(int64(id))