コード例 #1
0
ファイル: shfs_rev.c プロジェクト: neonatura/share
int shfs_rev_ref_write(shfs_ino_t *file, char *group, char *name, shbuf_t *buff)
{
  shfs_ino_t *ref;
  shfs_ino_t *aux;
  char buf[SHFS_PATH_MAX];
  int err;

  memset(buf, 0, sizeof(buf));
  snprintf(buf, sizeof(buf) - 1, "%s/%s", group, name);
  ref = shfs_inode(file, buf, SHINODE_OBJECT);
  err = shfs_bin_write(ref, buff);
  if (err)
    return (err);
#if 0
  err = shfs_aux_write(aux, buff);
  if (err)
    return (err);
#endif

  err = shfs_inode_write_entity(ref);
  if (err) {
    sherr(err, "shfs_rev_ref_write [shfs_inode_write_entity]");
    return (err);
  }

#if 0
  /* copy aux stats to file inode. */
  file->blk.hdr.mtime = ref->blk.hdr.mtime;
  file->blk.hdr.size = ref->blk.hdr.size;
  file->blk.hdr.crc = ref->blk.hdr.crc;
  file->blk.hdr.format = SHINODE_OBJECT;
#endif

  return (0);
}
コード例 #2
0
void shmap_load(shmap_t *ht, shbuf_t *buff)
{
  shmap_value_t *hdr;
  unsigned char *map_data;
  unsigned char *data;
  shsize_t b_len;
  shsize_t b_of;


  b_of = 0;
  b_len = shbuf_size(buff);
  map_data = shbuf_data(buff);

  while (b_of < b_len) {
    hdr = (shmap_value_t *)(map_data + b_of);
    b_of += sizeof(shmap_value_t);
    if (b_of > b_len) break;

    if (hdr->magic != SHMEM32_MAGIC) {
      sherr(SHERR_IO, "shmap_load: error reading map record.");
      continue;
    }

    data = NULL;
    if (hdr->sz) {
      data = (map_data + b_of);
      b_of += hdr->sz;
    }
    if (!data) {
      continue;
}
    shmap_set_ent(ht, &hdr->name, hdr->pf | SHMAP_ALLOC, data, hdr->sz);  
  }

}
コード例 #3
0
void sexe_exec_pclose(sexe_t *S)
{
  int err;

  err = update_sexe_userdata(S);
  if (err) {
    sherr(err, "sexe_exec_pclose: update sexe userdata.");
  }

  lua_close(S);
}