Пример #1
0
static gfarm_error_t
get_inonum_request(struct gfm_connection *conn, struct gfp_xdr_context *ctx,
	struct file_info *f, int stat_or_open, int open_parent)
{
	gfarm_error_t e;
	const char *errf;
	const char *name;

	assert(strlen(f->name) > 0 || stat_or_open);
	name = open_parent ? "." : f->name;

	if (stat_or_open) {
		if ((e = gfm_client_fstat_request(conn, ctx))
		    != GFARM_ERR_NO_ERROR)
			errf = "gfm_client_fstat_request";
	} else if ((e = gfm_client_open_request(conn, ctx, name,
		strlen(name), GFARM_FILE_RDONLY)) != GFARM_ERR_NO_ERROR) {
		errf = "gfm_client_open_request";
	}
	if (e != GFARM_ERR_NO_ERROR) {
		fprintf(stderr, "get_inonum_request : %s : %s\n",
		    errf, gfarm_error_string(e));
		return (e);
	}
	return (GFARM_ERR_NO_ERROR);
}
Пример #2
0
gfarm_error_t
gfs_stat(const char *path, struct gfs_stat *s)
{
	gfarm_error_t e;
	gfarm_timerval_t t1, t2;

	GFARM_TIMEVAL_FIX_INITIALIZE_WARNING(t1);
	gfs_profile(gfarm_gettimerval(&t1));

	if ((e = gfm_client_compound_begin_request(gfarm_metadb_server))
	    != GFARM_ERR_NO_ERROR)
		gflog_warning("compound_begin request: %s",
		    gfarm_error_string(e));
	else if ((e = gfm_tmp_open_request(gfarm_metadb_server, path,
	    GFARM_FILE_LOOKUP)) != GFARM_ERR_NO_ERROR)
		gflog_warning("tmp_open(%s) request: %s", path,
		    gfarm_error_string(e));
	else if ((e = gfm_client_fstat_request(gfarm_metadb_server))
	    != GFARM_ERR_NO_ERROR)
		gflog_warning("fstat request: %s",
		    gfarm_error_string(e));
	else if ((e = gfm_client_compound_end_request(gfarm_metadb_server))
	    != GFARM_ERR_NO_ERROR)
		gflog_warning("compound_end request: %s",
		    gfarm_error_string(e));

	else if ((e = gfm_client_compound_begin_result(gfarm_metadb_server))
	    != GFARM_ERR_NO_ERROR)
		gflog_warning("compound_begin result: %s",
		    gfarm_error_string(e));
	else if ((e = gfm_tmp_open_result(gfarm_metadb_server, path, NULL))
	    != GFARM_ERR_NO_ERROR)
#if 0
		gflog_warning("tmp_open(%s) result: %s", path,
		    gfarm_error_string(e));
#else
		;
#endif
	else if ((e = gfm_client_fstat_result(gfarm_metadb_server, s))