MCPcopy Create free account
hub / github.com/alibaba/MNN / MNNCreateFile

Function MNNCreateFile

source/core/MNNFileUtils.cpp:57–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57file_t MNNCreateFile(const char * file_name)
58{
59#if defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)
60 HANDLE hd = CreateFile(
61 file_name, // File Name
62 GENERIC_READ | GENERIC_WRITE, // Read and Write
63 0, // No Sharing
64 NULL, // No Security
65 CREATE_ALWAYS, // Create the file and cover the existing file
66 FILE_ATTRIBUTE_NORMAL, // Normal Attribute
67 NULL // No Template
68 );
69 if (hd == INVALID_HANDLE_VALUE) {
70 MNN_PRINT("Failed to create the file: %s\n", file_name);
71 return INVALID_FILE;
72 }
73 return hd;
74#else
75 int fd = open(
76 file_name, // File Name
77 O_RDWR | O_CREAT | O_TRUNC, // Read and Write and Create the file and cover existing file
78 0666 // Read and Write Permission for Everyone
79 );
80 if (fd == -1) {
81 MNN_PRINT("Failed to create the file: %s\n", file_name);
82 return INVALID_FILE;
83 }
84 return fd;
85#endif
86}
87
88file_t MNNOpenFile(const char * file_name, uint32_t flags)
89{

Callers 10

parseCmdParamsFunction · 0.85
completePrefixWriteMethod · 0.85
onAllocMethod · 0.85
syncMethod · 0.85
onExecuteMethod · 0.85
saveKVCacheInDiskMethod · 0.85
createKVCacheFileMethod · 0.85
onAllocMethod · 0.85
syncMethod · 0.85
runMethod · 0.85

Calls 1

openFunction · 0.85

Tested by 1

runMethod · 0.68