mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(sdk): add cfs_IsDir,cfs_IsRegular for libsdk.
Signed-off-by: baihailong <baihailong@oppo.com>
This commit is contained in:
parent
6aca325797
commit
f08ff32bff
@ -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
|
||||
}
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user