int si_nodeopen(sinode *n, sr *r, sischeme *scheme, sspath *path, sdsnapshotnode *sn) { int rc = ss_fileopen(&n->file, path->path); if (ssunlikely(rc == -1)) { sr_malfunction(r->e, "db file '%s' open error: %s", ss_pathof(&n->file.path), strerror(errno)); return -1; } rc = ss_fileseek(&n->file, n->file.size); if (ssunlikely(rc == -1)) { sr_malfunction(r->e, "db file '%s' seek error: %s", ss_pathof(&n->file.path), strerror(errno)); goto error; } int in_memory = 0; if (scheme->storage == SI_SIN_MEMORY) in_memory = 1; rc = si_noderecover(n, r, sn, in_memory); if (ssunlikely(rc == -1)) goto error; if (scheme->mmap) { rc = si_nodemap(n, r); if (ssunlikely(rc == -1)) goto error; } return 0; error: si_nodeclose(n, r, 0); return -1; }
int si_nodeopen(sinode *n, sr *r, sischeme *scheme, sspath *path) { int rc = ss_fileopen(&n->file, path->path); if (ssunlikely(rc == -1)) { sr_malfunction(r->e, "db file '%s' open error: %s", ss_pathof(&n->file.path), strerror(errno)); return -1; } rc = ss_fileseek(&n->file, n->file.size); if (ssunlikely(rc == -1)) { sr_malfunction(r->e, "db file '%s' seek error: %s", ss_pathof(&n->file.path), strerror(errno)); goto error; } rc = si_noderecover(n, r, scheme->in_memory); if (ssunlikely(rc == -1)) goto error; if (scheme->mmap) { rc = si_nodemap(n, r); if (ssunlikely(rc == -1)) goto error; } return 0; error: si_nodeclose(n, r); return -1; }