コード例 #1
0
END_TEST

START_TEST(test_setTimes)
{
	bool s;
	struct hdfs_object *e = NULL;
	const char *tf = "/HADOOFUS_TEST_SETTIMES",
	      *client = "HADOOFUS_CLIENT";

	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	hdfs_setTimes(h, tf, -1, -1, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
コード例 #2
0
ファイル: hdfs.c プロジェクト: 13141516/hadoofus
/**
 * hdfsUtime
 *
 * @param fs The configured filesystem handle.
 * @param path the path to the file or directory
 * @param mtime new modification time or 0 for only set access time in seconds
 * @param atime new access time or 0 for only set modification time in seconds
 * @return 0 on success else -1
 */
int
hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime)
{
	int res = 0;
	struct hdfsFS_internal *client = fs;
	struct hdfs_object *ex = NULL;
	char *path_abs = _makeabs(fs, path);

	hdfs_setTimes(client->fs_namenode, path_abs,
	    (int64_t)mtime*1000, (int64_t)atime*1000, &ex);
	if (ex) {
		ERR(EIO, "setTimes(): %s", hdfs_exception_get_message(ex));
		res = -1;
		goto out;
	}

out:
	if (ex)
		hdfs_object_free(ex);
	if (path_abs != path)
		free(path_abs);
	return res;
}