int dfs_mkdir(const char *path, mode_t mode) { dpl_status_t rc; int ret; tpath_entry *pe = NULL; char *key = NULL; LOG(LOG_DEBUG, "path=%s, mode=0x%x", path, (int)mode); rc = dfs_mkdir_timeout(ctx, path); if (DPL_SUCCESS != rc) { LOG(LOG_ERR, "dfs_mkdir_timeout: %s", dpl_status_str(rc)); ret = -1; goto err; } pe = g_hash_table_lookup(hash, path); if (! pe) { if (-1 == populate_hash(hash, path, FILE_DIR, &pe)) { LOG(LOG_ERR, "populate with path %s failed", path); ret = -1; goto err; } LOG(LOG_DEBUG, "added a new dir entry in hashtable: %s", path); } pe->filetype = FILE_DIR; ret = 0; err: LOG(LOG_DEBUG, "path=%s ret=%s", path, dpl_status_str(ret)); return ret; }
int dfs_open(const char *path, struct fuse_file_info *info) { pentry_t *pe = NULL; int fd = -1; int ret = -1; enum state_mode mode; info->fh = 0; LOG(LOG_DEBUG, "path=%s %s 0%o", path, flags_to_str(info->flags), info->flags); pe = g_hash_table_lookup(hash, path); if (! pe) { LOG(LOG_INFO, "'%s': entry not found in hashtable", path); if (-1 == populate_hash(hash, path, &pe)) { ret = -1; goto err; } LOG(LOG_INFO, "adding file '%s' to the hashtable", path); } else { fd = pentry_get_fd(pe); if (FILE_LOCAL == pentry_get_placeholder(pe)) LOG(LOG_INFO, "%s: found in the hashtable, and the " "file is on disk (fd=%d)", path, fd); else LOG(LOG_INFO, "%s: found in hashtable, but the file " "isn't downloaded (fd=%d)", path, fd); } info->fh = (uint64_t)pe; pentry_inc_refcount(pe); mode = get_mode_from_flags(info->flags); if (MODE_RDONLY != mode) { if (pentry_lock(pe)) { ret = -1; pentry_dec_refcount(pe); goto err; } } info->fh = (uint64_t)pe; LOG(LOG_DEBUG, "path=%s, MODE=%d", path, mode); int (*fn[])(const char *, pentry_t *, int) = { [MODE_RDONLY] = open_rdonly, [MODE_WRONLY] = open_wronly, [MODE_RDWR] = open_rdwr, [MODE_CREAT] = open_creat, };
static void unpack_attr_set(gpointer data, gpointer user_data) { sorted_set_t *pair = data; struct unpack_data_s *unpack_data = user_data; if (test_ruleset(pair->attr_set, unpack_data->node_hash, unpack_data->now) == FALSE) { return; } crm_trace("Adding attributes from %s", pair->name); populate_hash(pair->attr_set, unpack_data->hash, unpack_data->overwrite, unpack_data->top); }