コード例 #1
0
ファイル: chirp_multi.c プロジェクト: liblit/Murphy
INT64_T chirp_multi_stat(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_stat(info.rhost, info.rpath, buf, stoptime);
	} else if(errno == EISDIR) {
		return chirp_reli_stat(current_volume->host, info.lpath, buf, stoptime);
	} else {
		return -1;
	}
}
コード例 #2
0
ファイル: chirp_tool.c プロジェクト: ailurus1991/cctools
static INT64_T do_stat(int argc, char **argv)
{
	char full_path[CHIRP_PATH_MAX];
	struct chirp_stat info;
	time_t t;

	complete_remote_path(argv[1], full_path);

	if(chirp_reli_stat(current_host, full_path, &info, stoptime) < 0) {
		return -1;
	} else {
		printf("device:  %" PRId64 "\n", info.cst_dev);
		printf("inode:   %" PRId64 "\n", info.cst_ino);
		printf("mode:    %04" PRIu64 "\n", info.cst_mode);
		printf("nlink:   %" PRId64 "\n", info.cst_nlink);
		printf("uid:     %" PRId64 "\n", info.cst_uid);
		printf("gid:     %" PRId64 "\n", info.cst_gid);
		printf("rdevice: %" PRId64 "\n", info.cst_rdev);
		printf("size:    %" PRId64 "\n", info.cst_size);
		printf("blksize: %" PRId64 "\n", info.cst_blksize);
		printf("blocks:  %" PRId64 "\n", info.cst_blocks);
		t = info.cst_atime;
		printf("atime:   %s", ctime(&t));
		t = info.cst_mtime;
		printf("mtime:   %s", ctime(&t));
		t = info.cst_ctime;
		printf("ctime:   %s", ctime(&t));
		return 0;
	}
}
コード例 #3
0
ファイル: chirp_benchmark.c プロジェクト: liblit/Murphy
int do_stat(const char *file, struct stat *buf)
{
	if(do_chirp) {
		struct chirp_stat lbuf;
		return chirp_reli_stat(host, file, &lbuf, stoptime);
	} else {
		return stat(file, buf);
	}
}
コード例 #4
0
ファイル: chirp_global.c プロジェクト: msultan/cctools
INT64_T chirp_global_stat(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_stat(mhost, mpath, buf, stoptime);
	} else if(not_empty(path)) {
		return chirp_reli_stat(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_stat(host, "/", buf, stoptime);
		}
	} else {
		chirp_blank_stat(buf);
		return 0;
	}
}
コード例 #5
0
ファイル: chirp_tool.c プロジェクト: ailurus1991/cctools
static INT64_T do_cd(int argc, char **argv)
{
	char full_path[CHIRP_PATH_MAX];
	struct chirp_stat info;
	complete_remote_path(argv[1], full_path);
	if(chirp_reli_stat(current_host, full_path, &info, stoptime) < 0) {
		return -1;
	} else {
		if(S_ISDIR(info.cst_mode)) {
			path_collapse(full_path, current_remote_dir, 1);
			return 0;
		} else {
			errno = ENOTDIR;
			return -1;
		}
	}
}