Exemplo n.º 1
0
JNIEXPORT void JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_setIsDumpRetainedPermanently
	(JNIEnv *env, jclass cls, /*ARGSUSED*/ jobject ctx,
	jstring dumpPath, jboolean retainValue) {

	jboolean isCopy;
	char *pDumpPathStr = GET_STR(dumpPath, isCopy);

	PTRACE(1, "jni:Restore_setIsDumpRetainedPermanently(...,%s,%d) entry",
	Str(pDumpPathStr), retainValue);

	if (JNI_TRUE == retainValue) {
	// Call setter
		if (-1 == set_snapshot_locked(CTX, pDumpPathStr)) {
			REL_STR(dumpPath, pDumpPathStr, isCopy);
			ThrowEx(env);
		return;
		}
	} else {
	// Call clearer
	if (-1 == clear_snapshot_locked(CTX, pDumpPathStr)) {
		REL_STR(dumpPath, pDumpPathStr, isCopy);
		ThrowEx(env);
		return;
	}
	}

    REL_STR(dumpPath, pDumpPathStr, isCopy);

    PTRACE(1, "jni:Restore_setIsDumpRetainedPermanently() done");
}
Exemplo n.º 2
0
ulonglong get_open_file_size (int fhandle)
{
    off_t curpos = ::sci_lseek (fhandle, 0, SEEK_CUR);
    if (-1 == curpos)
        ers << "Unable to determine current position in file" << ThrowEx (OSRerror);
    off_t fsz = ::sci_lseek (fhandle, 0, SEEK_END);
    if (-1 == fsz)
        ers << "Unable to seek file to end" << ThrowEx (OSRerror);
    if (-1 == ::sci_lseek (fhandle, curpos, SEEK_SET))
        ers << "Unable to seek file to " << curpos << ThrowEx (OSRerror);
    return (ulonglong) fsz;
}
Exemplo n.º 3
0
bool TestErrorHandling::process ()
{
    try
    {
        ers << "Testing Throw mechanism";
        ers << Throw;
        TEST_FAILURE ("Throw mechanism testing failed");
    }
    catch (Rerror& r)
    {
        o_ << "Throw mechanism testing succeeded, msg = " << (const char*) r << ", exception is " << r << std::endl;
    }
    try
    {
        ERR ("Testing ERR macro");
        TEST_FAILURE ("ERR macro testing failed");
    }
    catch (Rerror& r)
    {
        o_ << "ERR macro testing succeeded, exception = " << r << std::endl;
    }
    try
    {
        ers << "Testing ThrowEx mechanism" << ThrowEx (InternalRerror);
        TEST_FAILURE ("ThrowEx mechanism testing failed");
    }
    catch (InternalRerror& ir)
    {
        o_ << "ThrowEx mechanism testing succeeded, exception = " << ir << std::endl;
    }
    catch (Rerror& r)
    {
        o_ << "ThrowEx mechanism testing FAILED, Rerror exception caught instead of InternalRerror : " << r << std::endl;
        TEST_FAILURE ("ThrowEx mechanism testing FAILED, Rerror exception caught instead of InternalRerror");
    }
    try
    {
        ers << "Testing OSRerror" << ThrowEx (OSRerror);
        TEST_FAILURE ("OSRerror testing failed");
    }
    catch (OSRerror& osr)
    {
        o_ << "OSRerror testing succeeded, exc = " << osr << std::endl;
    }
    catch (Rerror& r)
    {
        o_ << "OSRerror testing FAILED, Rerror caught instead : " << r << std::endl;
        TEST_FAILURE ("OSRerror testing FAILED, Rerror caught instead");
    }
    return true;
}
Exemplo n.º 4
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_getIndexedSnaps(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsname, jstring snapdir) {

	jboolean isCopy, isCopy2;
	char *fstr = GET_STR(fsname, isCopy);
	char *dstr = GET_STR(snapdir, isCopy2);
	sqm_lst_t *snaplist = NULL;
	jobjectArray newArr;

	PTRACE(1, "jni:Restore_getIndexedSnaps(..., %s) entry", Str(fstr));
	if (-1 == get_indexed_snapshots(CTX, fstr, dstr, &snaplist)) {
		REL_STR(fsname, fstr, isCopy);
		REL_STR(snapdir, dstr, isCopy2);
		ThrowEx(env);
		return (NULL);
	}

	REL_STR(fsname, fstr, isCopy);
	REL_STR(snapdir, dstr, isCopy2);

	newArr = lst2jarray(env, snaplist, "java/lang/String", charr2String);
	lst_free_deep(snaplist);

	PTRACE(1, "jni:Restore_getIndexedSnaps() done");
	return (newArr);
}
Exemplo n.º 5
0
JNIEXPORT jstring JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_restoreInodes(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsname, jstring dumppath,
    jobjectArray filepaths, jobjectArray destinations, jintArray copies,
    jint replaceType) {

	char *str = NULL;

	jboolean isCopy, isCopy2;
	char *fstr = GET_STR(fsname, isCopy);
	char *dstr = GET_STR(dumppath, isCopy2);

	PTRACE(1, "jni:Restore_restoreInodes() entry");

	if (-1 == restore_inodes(CTX, fstr,
	    dstr, jarray2lst(env, filepaths, "java/Lang/String", String2charr),
	    jarray2lst(env, destinations, "java/Lang/String", String2charr),
	    jintArray2lst(env, copies), replaceType,
	    &str)) {

		REL_STR(fsname, fstr, isCopy);
		REL_STR(dumppath, dstr, isCopy2);
		ThrowEx(env);
		return (NULL);
	}
	REL_STR(fsname, fstr, isCopy);
	REL_STR(dumppath, dstr, isCopy2);
	PTRACE(1, "jni:Restore_restoreInodes() done");
	return (JSTRING(str));

}
Exemplo n.º 6
0
// getDumpStatus(fsName, directory);
// Calls get_Dump_Status_by_dir
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_getDumpStatus__Lcom_sun_netstorage_samqfs_mgmt_Ctx_2Ljava_lang_String_2Ljava_lang_String_2_3Ljava_lang_String_2
(JNIEnv *env, jclass cls /*ARGSUSED*/, jobject ctx, jstring fsname,
	jstring directory, jobjectArray dumps) {

	sqm_lst_t *statuslst = NULL;
	jobjectArray newArr;
	jboolean isFsNameCopy;
	jboolean isDirectoryCopy;
	char *cstr_fsname = GET_STR(fsname, isFsNameCopy);
	char *cstr_directory = GET_STR(directory, isDirectoryCopy);

	PTRACE(1, "jni:Restore_getDumpStatus() entry");
	if (-1 == get_dump_status_by_dir(CTX, cstr_fsname, cstr_directory,
	    jarray2lst(env, dumps, "java/lang/String", String2charr),
	    &statuslst)) {
		REL_STR(fsname, cstr_fsname, isFsNameCopy);
		REL_STR(directory, cstr_directory, isDirectoryCopy);
		ThrowEx(env);
		return (NULL);
	}

	REL_STR(fsname, cstr_fsname, isFsNameCopy);
	REL_STR(directory, cstr_directory, isDirectoryCopy);
	newArr = lst2jarray(env, statuslst, "java/lang/String", charr2String);
	lst_free_deep(statuslst);

	PTRACE(1, "jni:Restore_getDumpStatus() done");
	return (newArr);
}
Exemplo n.º 7
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_getVersionDetails(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsname,
    jstring dumppath, jstring filepath) {

	sqm_lst_t *detailslst = NULL;
	jobjectArray newArr;

	jboolean isCopy, isCopy2, isCopy3;
	char *fstr = GET_STR(fsname, isCopy);
	char *dstr = GET_STR(dumppath, isCopy2);
	char *cstr = GET_STR(filepath, isCopy3);

	PTRACE(1, "jni:Restore_getVersionDetails(...,%s)", Str(cstr));
	if (-1 == get_version_details(CTX, fstr, dstr, cstr, &detailslst)) {
		REL_STR(fsname, fstr, isCopy);
		REL_STR(dumppath, dstr, isCopy2);
		REL_STR(filepath, cstr, isCopy3);
		ThrowEx(env);
		return (NULL);
	}

	REL_STR(fsname, fstr, isCopy);
	REL_STR(dumppath, dstr, isCopy2);
	REL_STR(filepath, cstr, isCopy3);

	newArr = lst2jarray(env, detailslst, "java/lang/String", charr2String);
	lst_free_deep(detailslst);

	PTRACE(1, "jni:Restore_getVersionDetails() done");
	return (newArr);
}
Exemplo n.º 8
0
JNIEXPORT jlong JNICALL
Java_com_sun_netstorage_samqfs_mgmt_SamFSConnection_getTimeout(JNIEnv *env,
    jobject samConn) {

#ifdef LOCALMGMT
	/*
	 * The reference to samrpc_get_timeout() causes a link error,
	 * even if this method is not called.
	 */

	return (0);
#else
	time_t secs;
	jlong connHandle;

	PTRACE(1, "jni:SamFSConnection_getTimeout()");
	connHandle = getConnHandle(env, samConn);
	if (-1 == samrpc_get_timeout((samrpc_client_t *)connHandle, &secs)) {
		ThrowEx(env);
		return (-1);
	}
	PTRACE(1, "jni:SamFSConnection_getTimeout() done");
	return ((jlong)secs);
#endif
}
Exemplo n.º 9
0
JNIEXPORT jstring JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_searchFiles(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsname, jstring dumppath,
    jint entries, jstring filepath, jstring restrictions) {

	char *str = NULL;

	jboolean isCopy, isCopy2, isCopy3, isCopy4;
	char *fstr = GET_STR(fsname, isCopy);
	char *dstr = GET_STR(dumppath, isCopy2);
	char *cstr = GET_STR(filepath, isCopy3);
	char *rstr = GET_STR(restrictions, isCopy4);

	PTRACE(1, "jni:Restore_searchFiles(...,%s, %s) entry",
	    Str(cstr), Str(rstr));
	if (-1 == search_versions(CTX,
	    fstr, dstr, (int)entries, cstr, rstr, &str)) {
		REL_STR(fsname, fstr, isCopy);
		REL_STR(dumppath, dstr, isCopy2);
		REL_STR(filepath, cstr, isCopy3);
		REL_STR(restrictions, rstr, isCopy4);
		ThrowEx(env);
		return (NULL);
	}

	REL_STR(fsname, fstr, isCopy);
	REL_STR(dumppath, dstr, isCopy2);
	REL_STR(filepath, cstr, isCopy3);
	REL_STR(restrictions, rstr, isCopy4);

	PTRACE(1, "jni:Restore_searchFiles() done");
	return (JSTRING(str));
}
Exemplo n.º 10
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Host_getAdvancedNetCfg(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsName) {


	jobjectArray newArr;
	sqm_lst_t *lst;
	jboolean isCopy; /* used by string macros */
	char *cstr = GET_STR(fsName, isCopy);

	PTRACE(1, "jni:Host_getAdvancedNetCfg(...,%s)", Str(cstr));

	if (-1 == get_advanced_network_cfg(CTX, cstr, &lst)) {
		REL_STR(fsName, cstr, isCopy);
		ThrowEx(env);
		return (NULL);
	}
	PTRACE(1, "jni:advanced net cfg information obtained");

	newArr = lst2jarray(env, lst, "java/lang/String", charr2String);
	REL_STR(fsName, cstr, isCopy);
	lst_free_deep(lst);

	PTRACE(1, "jni:Host_getAdvancedNetCfg() done");
	return (newArr);
}
Exemplo n.º 11
0
JNIEXPORT jstring JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Restore_takeDump(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsname, jstring dumppath) {

	char *str = NULL;

	jboolean isCopy, isCopy2;
	char *fstr = GET_STR(fsname, isCopy);
	char *dstr = GET_STR(dumppath, isCopy2);

	PTRACE(1, "jni:Restore_takeDump(...,%s, %s) entry",
	    Str(fstr), Str(dstr));
	if (-1 == take_dump(CTX, fstr, dstr, &str)) {
		REL_STR(fsname, fstr, isCopy);
		REL_STR(dumppath, dstr, isCopy2);
		ThrowEx(env);
		return (NULL);
	}

	REL_STR(fsname, fstr, isCopy);
	REL_STR(dumppath, dstr, isCopy2);

	PTRACE(1, "jni:Restore_takeDump() done");
	return (JSTRING(str));
}
Exemplo n.º 12
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Host_getConfig(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsName) {

	jobjectArray newArr;
	sqm_lst_t *hlst;
	jboolean isCopy; /* used by string macros */
	char *cstr = GET_STR(fsName, isCopy);

	PTRACE(1, "jni:Host_getConfig(...,%s)", Str(cstr));

	if (-1 == get_host_config(CTX, cstr, &hlst)) {
		REL_STR(fsName, cstr, isCopy);
		ThrowEx(env);
		return (NULL);
	}
	PTRACE(1, "jni:host config information obtained");

	newArr = lst2jarray(env, hlst, BASEPKG"/fs/Host", host2Host);
	REL_STR(fsName, cstr, isCopy);
	free_list_of_host_info(hlst);
	PTRACE(1, "jni:Host_getConfig() done");
	return (newArr);

}
Exemplo n.º 13
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Host_getSharedFSHosts(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsName, jint options) {

	jobjectArray newArr;
	sqm_lst_t *kvlst;
	jboolean isCopy; /* used by string macros */
	char *cstr = GET_STR(fsName, isCopy);

	PTRACE(1, "jni:Host_getSharedFSHosts(...,%s)", Str(cstr));

	if (-1 == get_shared_fs_hosts(CTX, cstr, options, &kvlst)) {
		REL_STR(fsName, cstr, isCopy);
		ThrowEx(env);
		return (NULL);
	}
	PTRACE(1, "jni:shared host information obtained");

	newArr = lst2jarray(env, kvlst, "java/lang/String", charr2String);
	REL_STR(fsName, cstr, isCopy);
	lst_free_deep(kvlst);
	PTRACE(1, "jni:Host_getSharedFSHosts() done");
	return (newArr);

}
Exemplo n.º 14
0
JNIEXPORT jint JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Host_removeHosts(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsName,
    jobjectArray clients) {

	jboolean isCopy1;
	char *cstr1 = GET_STR(fsName, isCopy1);
	int ret;
	char **c_clients;
	int len;
	int i;

	PTRACE(1, "jni:Host_removeHosts(%s...) entry", Str(cstr1));

	/* Determine the array length */
	len = (int)(*env)->GetArrayLength(env, clients);


	/* convert the array */
	c_clients = (char **)jarray2arrOfPtrs(env, clients,
	    "java/lang/String", String2charr);

	if (c_clients == NULL) {
		REL_STR(fsName, cstr1, isCopy1);
		ThrowEx(env);
		return (NULL);
	}

	PTRACE(1, "jni:Host_removeHosts(%s...) converted clients", Str(cstr1));
	ret = remove_hosts(CTX, cstr1, c_clients, len);

	PTRACE(1, "jni:Host_removeHosts(%s...) converted clients", Str(cstr1));
	REL_STR(fsName, cstr1, isCopy1);
	for (i = 0; i < len; i++) {
		free(c_clients[i]);
	}
	free(c_clients);
	if (-1 == ret) {
		ThrowEx(env);
		return (NULL);
	}


	PTRACE(1, "jni:Host_remove_hosts() done");
	return (ret);
}
Exemplo n.º 15
0
void BufferedWriter::flush ()
{
    if (fhandle != -1 && buffer && cpos)
    {
        ssize_t wrcnt = ::sci_write (fhandle, buffer, cpos);
        if (wrcnt != cpos)
            ers << "Error flushing buffered writer" << ThrowEx (OSRerror);
        bufst += cpos;
        cpos = 0;
    }
}
Exemplo n.º 16
0
/* Archiver rerun is available in 4.4 (samfsversion 1.3.2) and above */
JNIEXPORT void JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_rerun(JNIEnv *env,
	jclass cls /*ARGSUSED*/, jobject ctx) {

	PTRACE(1, "jni:Archiver_rerun() entry");
	if (-1 == ar_rerun_all(CTX)) {
		ThrowEx(env);
		return;
	}
	PTRACE(1, "jni:Archiver_rerun() done");
}
Exemplo n.º 17
0
void checkCreateOutputFile (const char* output_name, bool overwrite, bool append)
{
    // walk to the parent dir, creating directories as needed
    std::ifstream tifile;
    tifile.open (output_name);
    if (tifile.is_open ())
    {
        tifile.close ();
        if (!overwrite && !append)
            ers << "Output file allready exist : " << output_name << " and neither overwite nor append are enabled" << Throw;
        else if (!append)
        {
            if (unlink (output_name) != 0)
                ers << "Unable to delete existing object: " << output_name << ThrowEx (OSRerror);
            std::ofstream tofile (output_name, std::ios::out);
            if (!tofile)
                ers << "Error creating new output file: " << output_name << ThrowEx (OSRerror);
            tofile.close ();
            if (unlink (output_name) != 0)
                ers << "Output file " << output_name << " is created but cannot be unlinked" << ThrowEx (OSRerror);
        }
        else
        {
            std::ofstream tofile (output_name, std::ios::app);
            if (!tofile)
                ers << "Error opening output file for append: " << output_name << ThrowEx (OSRerror);
            tofile.close ();
        }
    }
    else
    {
            std::ofstream tofile (output_name, std::ios::out);
            if (!tofile)
                ers << "Error creating new output file: " << output_name << ThrowEx (OSRerror);
            tofile.close ();
            if (unlink (output_name) != 0)
                ers << "Output file " << output_name << " is created but cannot be unlinked" << ThrowEx (OSRerror);
    }
}
Exemplo n.º 18
0
std::string Config::getValueStr(std::string key, int index, int depth)
{
	//LOG("Looking up: " << key, LOG_DEBUG);

	if(depth > SPANK_MAX_RECURSE){
		LOG("Recurse limit (" << SPANK_MAX_RECURSE << ") exceeded in Config::getValueStr(), probably because of key self referencing (or indirect self referencing).", LOG_ERROR);
		LOG("Might be in: " << key << "[" << index << "]", LOG_INFO);

		return "";
	} 

	if(configItems.count(key) != 0){
		if((unsigned int)index <= configItems[key].value.size()){
			std::string ret = configItems[key].value.at(index);

			//LOG("Parsing string: " << ret, LOG_DEBUG);

			size_t start = 0;

			while((start = ret.find("$("), start) != std::string::npos){
				size_t stop = ret.find(")", start);

				//LOG("start: " << start, LOG_DEBUG);
				//LOG("stop: " << stop, LOG_DEBUG);

				if(stop == std::string::npos){
					LOG("Error parsing key refernce: expected ')' near '" << ret << "'", LOG_ERROR);
				}

				std::string ref = ret.substr(start + 2, stop - start - 2);
				//LOG("reference: " << ref, LOG_DEBUG);
				std::string rep = getValueStr(ref, 0, depth + 1);
				//LOG("replacement value: " << rep, LOG_DEBUG);

				ret.replace(start, stop - start + 1, rep);
				//LOG("resulting string: " << ret, LOG_DEBUG);
			}

			return ret;
		}
	}

	char* env = getenv(key.c_str());
	if(env){
		return env;
	}

	ThrowEx(ConfigException, "Couldn't find config key: '" << key << "'");

	return "";
}
Exemplo n.º 19
0
JNIEXPORT jint JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Host_addHosts(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx, jstring fsName,
    jobjectArray hostInfos, jstring options) {

	jboolean isCopy1, isCopy2;
	char *cstr1 = GET_STR(fsName, isCopy1);
	char *cstr2 = GET_STR(options, isCopy2);
	int ret;
	sqm_lst_t *lst;
	int len;
	int i;

	PTRACE(1, "jni:Host_addHosts(%s...) entry", Str(cstr1));

	lst = jarray2lst(env, hostInfos, BASEPKG"/fs/Host", Host2host);

	if (lst == NULL) {
		REL_STR(fsName, cstr1, isCopy1);
		REL_STR(options, cstr2, isCopy2);
		ThrowEx(env);
		return (NULL);
	}

	ret = add_hosts(CTX, cstr1, lst, cstr2);

	REL_STR(fsName, cstr1, isCopy1);
	REL_STR(options, cstr2, isCopy2);
	free_list_of_host_info(lst);
	if (-1 == ret) {
		ThrowEx(env);
		return (NULL);
	}


	PTRACE(1, "jni:Host_add_hosts() done");
	return (ret);
}
Exemplo n.º 20
0
Compiler* System::getCompilerInstance()
{
	std::string compilertype = PROJECT->getValueStr("compilertype");

	if(compilertype == "gcc")
		return (Compiler*)SCompilerGcc::getInstance();

	else if(compilertype == "mcs")
		return (Compiler*)SCompilerMcs::getInstance();

	else if(compilertype == "vala")
		return SCompilerVala::getInstance();

	ThrowEx(SystemException, "Unknown compiler type: '" << compilertype << "'");
	return NULL;
}
Exemplo n.º 21
0
JNIEXPORT jobject JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_getArGlobalDirective(
	JNIEnv *env, jclass cls /*ARGSUSED*/, jobject ctx) {

	jobject newObj;
	ar_global_directive_t *argd;
	PTRACE(1, "jni:Archiver_getArGlobalDirective() entry");
	if (-1 == get_ar_global_directive(CTX, &argd)) {
		ThrowEx(env);
		return (NULL);
	}
	newObj = arglobd2ArGlobalDirective(env, argd);
	// displayCriteriaLst(argd->ar_set_lst);
	free_ar_global_directive(argd);
	PTRACE(1, "jni:Archiver_getArGlobalDirective() done");
	return (newObj);
}
Exemplo n.º 22
0
JNIEXPORT void JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_setArFSDirective(
	JNIEnv *env, jclass cls /*ARGSUSED*/, jobject ctx, jobject fsdObj) {

	ar_fs_directive_t *arfsd;
	int res;

	PTRACE(1, "jni:Archiver_setArFSDirective() entry");
	arfsd = ArFSDirective2arfsd(env, fsdObj);
	res = set_ar_fs_directive(CTX, arfsd);
	free_ar_fs_directive(arfsd);
	if (-1 == res) {
		ThrowEx(env);
		return;
	}
	PTRACE(1, "jni:Archiver_settArFSDirective() done");
}
Exemplo n.º 23
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_getCopyUtil(JNIEnv *env,
	jclass cls /*ARGSUSED*/, jobject ctx, jint topCount) {

	jobjectArray newArr;
	sqm_lst_t *lst;

	PTRACE(1, "jni:getCopyUtil() entry");
	if (-1 == get_copy_utilization(CTX, (int)topCount, &lst)) {
		ThrowEx(env);
		return (NULL);
	}
	newArr = lst2jarray(env, lst,  "java/lang/String", charr2String);
	lst_free_deep(lst);
	PTRACE(1, "jni:getCopyUtil() done");
	return (newArr);
}
Exemplo n.º 24
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_fs_Host_discoverIPsAndNames(JNIEnv *env,
    jclass cls /*ARGSUSED*/, jobject ctx) {

	sqm_lst_t *lst;
	jobjectArray newArr;

	PTRACE(1, "jni:discoverIPsAndNames entry");
	if (-1 == discover_ip_addresses(CTX, &lst)) {
		ThrowEx(env);
		return (NULL);
	}
	newArr = lst2jarray(env, lst, "java/lang/String", charr2String);
	lst_free_deep(lst);
	PTRACE(1, "jni:discoverIPsAndNames done");
	return (newArr);
}
Exemplo n.º 25
0
JNIEXPORT jstring JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_archiveFiles(JNIEnv *env,
    jclass cls /* ARGSUSED */, jobject ctx, jobjectArray files, jint options) {
	char *jobID;


	PTRACE(1, "jni:Releaser_releaseFiles() entry");
	if (-1 == archive_files(CTX,
	    jarray2lst(env, files, "java/lang/String", String2charr),
	    (int32_t)options, &jobID)) {
		ThrowEx(env);
		return (NULL);
	}

	PTRACE(1, "jni:Archiver_archiveFiles() exit");
	return (JSTRING(jobID));
}
Exemplo n.º 26
0
JNIEXPORT void JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_setCopyParams(
	JNIEnv *env, jclass cls /*ARGSUSED*/, jobject ctx, jobject cprmObj) {

	ar_set_copy_params_t *cp;
	int res;

	PTRACE(1, "jni:Archiver_setCopyParams() entry");
	cp = CopyParams2cparams(env, cprmObj);
	res = set_ar_set_copy_params(CTX, cp);
	free(cp);
	if (-1 == res) {
		ThrowEx(env);
		return;
	}
	PTRACE(1, "jni:Archiver_setCopyParams() done");
}
Exemplo n.º 27
0
JNIEXPORT void JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_modifyArSet(JNIEnv *env,
	jclass cls /*ARGSUSED*/, jobject ctx, jobject jset) {

	arch_set_t *set;
	int res;
	PTRACE(1, "jni:Archiver_modifyArSet() entry");
	set = ArSet2archset(env, jset);
	res = modify_arch_set(CTX, set);

	free_arch_set(set);
	if (-1 == res) {
		ThrowEx(env);
		return;
	}
	PTRACE(1, "jni:Archiver_modifyArSet() done");
}
Exemplo n.º 28
0
JNIEXPORT jobject JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_getDefaultArFSDirective(
	JNIEnv *env, jclass cls /*ARGSUSED*/, jobject ctx) {

	jobject newObj;
	ar_fs_directive_t *arfsd;

	PTRACE(1, "jni:Archiver_getDefaultArFSDirective() entry");
	if (-1 == get_default_ar_fs_directive(CTX, &arfsd)) {
		ThrowEx(env);
		return (NULL);
	}
	newObj = arfsd2ArFSDirective(env, arfsd);
	free_ar_fs_directive(arfsd);
	PTRACE(1, "jni:Archiver_getDefaultArFSDirective() done");
	return (newObj);
}
Exemplo n.º 29
0
JNIEXPORT jobject JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_getDefaultCopyParams(
	JNIEnv *env, jclass cls /*ARGSUSED*/, jobject ctx) {

	jobject newObj;
	ar_set_copy_params_t *cp;

	PTRACE(1, "jni:Archiver_getDefaultCopyParams() entry");
	if (-1 == get_default_ar_set_copy_params(CTX, &cp)) {
		ThrowEx(env);
		return (NULL);
	}
	newObj = cparams2CopyParams(env, cp);
	free(cp);
	PTRACE(1, "jni:Archiver_getDefaultCopyParams() done");
	return (newObj);
}
Exemplo n.º 30
0
JNIEXPORT jobjectArray JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_job_ArFindJob_getAll(JNIEnv *env,
	jclass cls /*ARGSUSED*/, jobject ctx) {

	jobjectArray newArr;
	sqm_lst_t *arfindlst; // list of ar_find_state_t

	PTRACE(1, "jni:ArFindJob_getAll() entry");
	if (-1 == get_all_arfind_state(CTX, &arfindlst)) {
		ThrowEx(env);
		return (NULL);
	}
	newArr = lst2jarray(env,
		arfindlst, BASEPKG"/arc/job/ArFindJob", arfind2ArFindJob);
	lst_free_deep(arfindlst);
	PTRACE(1, "jni:ArFindJob_getAll() done");
	return (newArr);
}