Exemplo n.º 1
0
int archivefs_getattr(const char* path, struct stat* info) {
  char fpath[PATH_MAX];
  fullpath(fpath, path);

  FileSystem* fs = NULL;
  FileNode* node;
  int ret;

  if (!getFile(fpath, &fs, &node)) {
    /* fs byl nalezen, ale soubor ne */
    if (fs != NULL) {
      print_err("GETATTR", path, ENOENT);
      return -ENOENT;
    }

    if ((ret = stat(fpath, info)) != 0) {
      ret = errno;
      print_err("GETATTR", path, ret);
    }
    return -ret;
  }

  struct stat* node_info = fs->getAttr(node);
  memcpy(info, node_info, sizeof(struct stat));

//   printStat(info);

  return 0;
}