MCPcopy Create free account
hub / github.com/SmingHub/Sming / setxattr

Method setxattr

Sming/Libraries/Spiffs/src/FileSystem.cpp:622–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622int FileSystem::setxattr(const char* path, AttributeTag tag, const void* data, size_t size)
623{
624#ifdef SPIFFS_STORE_META
625 FS_CHECK_PATH(path)
626 spiffs_stat ss;
627 int err = SPIFFS_stat(handle(), path ?: "", &ss);
628 CHECK_RES(err)
629 SpiffsMetaBuffer smb;
630 smb.assign(ss.meta);
631 err = smb.setxattr(tag, data, size);
632 if(err < 0) {
633 return err;
634 }
635 if(!smb.flags[SpiffsMetaBuffer::Flag::dirty]) {
636 return FS_OK;
637 }
638 err = SPIFFS_update_meta(handle(), path, &smb);
639 partition.sync();
640 return translateSpiffsError(err);
641#else
642 return Error::NotSupported;
643#endif
644}
645
646int FileSystem::getxattr(const char* path, AttributeTag tag, void* buffer, size_t size)
647{

Callers 1

fsetxattrMethod · 0.45

Calls 3

translateSpiffsErrorFunction · 0.85
assignMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected