Skip to content

Question: is the attr size limited to the block size? #280

Open
@dangfan

Description

@dangfan

When I set the block size to 512, and run the following code, it always stops after writing the first attr:

  for (int i = 0; i < 1000; ++i) {
    uint8_t buf[512];
    char path[10];
    sprintf(path, "%d\n", i);
    lfs_file_t file;
    if (lfs_file_open(&lfs, &file, path, LFS_O_CREAT | LFS_O_RDWR) < 0) {
      printf("Create file %s error\n", path);
      return 0;
    }
    if (lfs_file_write(&lfs, &file, NULL, 0) < 0) {
      printf("Write file %s error\n", path);
      return 0;
    }
    for (int j = 0; j < 256; ++j) {
      if ((ret = lfs_setattr(&lfs, path, j, buf, 486)) < 0) {
        printf("Set attr %d of %s error %d\n", j, path, ret);
        return 0;
      }
    }
    if (lfs_file_close(&lfs, &file) < 0) {
      printf("Close file %s error\n", path);
      return 0;
    }
  }

So is the attr size limited to the block size?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions