MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Create

Method Create

Kernel/src/fs/ext2.cpp:1252–1277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1250 }
1251
1252 int Ext2Volume::Create(Ext2Node* node, DirectoryEntry* ent, uint32_t mode){
1253 if((node->flags & FS_NODE_TYPE) != FS_NODE_DIRECTORY) return -ENOTDIR;
1254
1255 if(FindDir(node, ent->name)){
1256 Log::Info("[Ext2] Create: Entry %s already exists!", ent->name);
1257 return -EEXIST;
1258 }
1259
1260 Ext2Node* file = CreateNode();
1261
1262 if(!file){
1263 return -1;
1264 }
1265
1266 file->e2inode.mode = EXT2_S_IFREG;
1267 file->flags = FS_NODE_FILE;
1268 file->nlink = 1;
1269 file->e2inode.linkCount = 1;
1270 inodeCache.insert(file->inode, file);
1271 ent->node = file;
1272 ent->inode = file->inode;
1273 ent->flags = EXT2_FT_REG_FILE;
1274
1275 SyncNode(file);
1276 return InsertDir(node, *ent);
1277 }
1278
1279 int Ext2Volume::CreateDirectory(Ext2Node* node, DirectoryEntry* ent, uint32_t mode){
1280 if(readOnly){

Callers 2

SysOpenFunction · 0.45
RenameFunction · 0.45

Calls 5

InfoFunction · 0.85
AcquireWriteMethod · 0.80
ReleaseWriteMethod · 0.80
FindDirFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected