Example #1
0
INT64_T chirp_multi_lstat(const char *volume, const char *path, struct chirp_stat * buf, time_t stoptime)
{
	struct file_info info;

	if(!volume[0]) {
		return emulate_dir_stat(buf);
	} else if(chirp_multi_lookup(volume, path, &info, stoptime)) {
		return chirp_reli_lstat(info.rhost, info.rpath, buf, stoptime);
	} else if(errno == EISDIR) {
		return chirp_reli_lstat(current_volume->host, info.lpath, buf, stoptime);
	} else {
		return -1;
	}
}
Example #2
0
INT64_T chirp_global_lstat(const char *host, const char *path, struct chirp_stat * buf, time_t stoptime)
{
	if(is_multi_path(host)) {
		char mhost[CHIRP_PATH_MAX];
		char mpath[CHIRP_PATH_MAX];
		parse_multi_path(path, mhost, mpath);
		return chirp_multi_lstat(mhost, mpath, buf, stoptime);
	} else if(not_empty(path)) {
		return chirp_reli_lstat(host, path, buf, stoptime);
	} else if(not_empty(host)) {
		struct jx *j = server_lookup(host, stoptime);
		if(j) {
			chirp_jx_to_stat(j, buf);
			return 0;
		} else {
			return chirp_reli_lstat(host, "/", buf, stoptime);
		}
	} else {
		chirp_blank_stat(buf);
		return 0;
	}
}
Example #3
0
INT64_T chirp_recursive_get(const char *hostport, const char *source_file, const char *target_file, time_t stoptime)
{
	INT64_T result;
	struct chirp_stat info;

	result = chirp_reli_lstat(hostport, source_file, &info, stoptime);
	if(result >= 0) {
		if(S_ISLNK(info.cst_mode)) {
			result = do_get_one_link(hostport, source_file, target_file, stoptime);
		} else if(S_ISDIR(info.cst_mode)) {
			result = do_get_one_dir(hostport, source_file, target_file, info.cst_mode, stoptime);
		} else if(S_ISREG(info.cst_mode)) {
			result = do_get_one_file(hostport, source_file, target_file, info.cst_mode, info.cst_size, stoptime);
		} else {
			result = 0;
		}
	}

	return result;
}