Skip to content

Commit d0a2ad6

Browse files
Patrick Stuedipatrickstuedi
authored andcommitted
Updating copyright in libdisni
- Include libdisni in the rat checks
1 parent 059c06e commit d0a2ad6

File tree

3 files changed

+61
-66
lines changed

3 files changed

+61
-66
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
{% comment %}
33
4-
Copyright (C) 2018, IBM Corporation
4+
Copyright (C) 2016-2018, IBM Corporation
55
66
Licensed to the Apache Software Foundation (ASF) under one or more
77
contributor license agreements. See the NOTICE file distributed with

libdisni/src/verbs/com_ibm_disni_verbs_impl_NativeDispatcher.cpp

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Author: Patrick Stuedi <[email protected]>
55
*
6-
* Copyright (C) 2016, IBM Corporation
6+
* Copyright (C) 2016-2018, IBM Corporation
77
*
88
* Licensed under the Apache License, Version 2.0 (the "License");
99
* you may not use this file except in compliance with the License.
@@ -78,48 +78,42 @@ static unsigned long long createObjectId(void *obj) {
7878
*/
7979
}
8080

81-
8281
/**
8382
* Throw a Java exception by name. Similar to SignalError.
8483
*/
85-
JNIEXPORT void JNICALL
86-
JNU_ThrowByName(JNIEnv *env, const char *name, const char *msg)
87-
{
88-
jclass cls = env->FindClass(name);
84+
JNIEXPORT void JNICALL JNU_ThrowByName(JNIEnv *env, const char *name,
85+
const char *msg) {
86+
jclass cls = env->FindClass(name);
8987

90-
if (cls != 0) /* Otherwise an exception has already been thrown */
91-
env->ThrowNew(cls, msg);
88+
if (cls != 0) /* Otherwise an exception has already been thrown */
89+
env->ThrowNew(cls, msg);
9290
}
9391

9492
/* Throw an IOException, using provided message string.
9593
*/
96-
void JNU_ThrowIOException(JNIEnv *env, const char *msg)
97-
{
98-
JNU_ThrowByName(env, "java/io/IOException", msg);
94+
void JNU_ThrowIOException(JNIEnv *env, const char *msg) {
95+
JNU_ThrowByName(env, "java/io/IOException", msg);
9996
}
10097

10198
/* Throw an IOException, using the last-error string for the detail
10299
* string.
103100
*/
104-
void JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *msg)
105-
{
106-
char* errorMsg;
107-
asprintf(&errorMsg, "%s: %s\n", msg, strerror(errno));
108-
JNU_ThrowIOException(env, errorMsg);
109-
free(errorMsg);
101+
void JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *msg) {
102+
char *errorMsg;
103+
asprintf(&errorMsg, "%s: %s\n", msg, strerror(errno));
104+
JNU_ThrowIOException(env, errorMsg);
105+
free(errorMsg);
110106
}
111107

112108
/* Throw an IOException, using return code.
113109
*/
114-
void JNU_ThrowIOExceptionWithReturnCode(JNIEnv *env, const char *msg, int ret)
115-
{
116-
char* errorMsg;
117-
asprintf(&errorMsg, "%s: %s\n", msg, strerror(ret));
118-
JNU_ThrowIOException(env, errorMsg);
119-
free(errorMsg);
110+
void JNU_ThrowIOExceptionWithReturnCode(JNIEnv *env, const char *msg, int ret) {
111+
char *errorMsg;
112+
asprintf(&errorMsg, "%s: %s\n", msg, strerror(ret));
113+
JNU_ThrowIOException(env, errorMsg);
114+
free(errorMsg);
120115
}
121116

122-
123117
/*
124118
* Class: com_ibm_disni_verbs_impl_NativeDispatcher
125119
* Method: _createEventChannel
@@ -139,8 +133,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1createEventChannel(
139133
log("j2c::createEventChannel: obj_id %llu\n", obj_id);
140134
} else {
141135
log("j2c::createEventChannel: rdma_create_event_channel failed\n");
142-
JNU_ThrowIOExceptionWithLastError(env,
143-
"j2c::createEventChannel: rdma_create_event_channel failed");
136+
JNU_ThrowIOExceptionWithLastError(
137+
env, "j2c::createEventChannel: rdma_create_event_channel failed");
144138
}
145139

146140
return obj_id;
@@ -170,7 +164,7 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1createId(JNIEnv *env,
170164
} else {
171165
log("j2c::createId: rdma_create_id failed\n");
172166
JNU_ThrowIOExceptionWithLastError(env,
173-
"j2c::createId: rdma_create_id failed");
167+
"j2c::createId: rdma_create_id failed");
174168
}
175169
} else {
176170
log("j2c::createId: cm_channel (%p) \n", cm_channel);
@@ -230,11 +224,13 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1createQP(
230224
ret = ibv_query_qp(qp, &tmp_attr, IBV_QP_STATE, &tmp_init_attr);
231225
} else {
232226
log("j2c::createQP: rdma_create_qp failed %s\n", strerror(errno));
233-
JNU_ThrowIOExceptionWithLastError(env, "j2c::createQP: rdma_create_qp failed");
227+
JNU_ThrowIOExceptionWithLastError(env,
228+
"j2c::createQP: rdma_create_qp failed");
234229
}
235230
} else {
236231
log("j2c::createQP: cm_listen_id or protection or cq null\n");
237-
JNU_ThrowIOException(env, "j2c::createQP: cm_listen_id or protection or cq null\n");
232+
JNU_ThrowIOException(
233+
env, "j2c::createQP: cm_listen_id or protection or cq null\n");
238234
}
239235

240236
return obj_id;
@@ -261,7 +257,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1bindAddr(JNIEnv *env,
261257
} else {
262258
log("j2c::bind: rdma_bind_addr failed, cm_listen_id %p \n",
263259
(void *)cm_listen_id);
264-
JNU_ThrowIOExceptionWithLastError(env, "j2c::bind: rdma_bind_addr failed");
260+
JNU_ThrowIOExceptionWithLastError(env,
261+
"j2c::bind: rdma_bind_addr failed");
265262
}
266263
} else {
267264
log("j2c::bind: cm_listen_id null\n");
@@ -307,12 +304,13 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1resolveAddr(
307304
cm_listen_id = (struct rdma_cm_id *)id;
308305
if (cm_listen_id != NULL) {
309306
int ret = rdma_resolve_addr(cm_listen_id, NULL, (struct sockaddr *)d_addr,
310-
(int)timeout);
307+
(int)timeout);
311308
if (ret == 0) {
312309
log("j2c::resolveAddr: ret %i\n", ret);
313310
} else {
314311
log("j2c::resolveAddr: rdma_resolve_addr failed\n");
315-
JNU_ThrowIOExceptionWithLastError(env, "j2c::resolveAddr: rdma_resolve_addr failed");
312+
JNU_ThrowIOExceptionWithLastError(
313+
env, "j2c::resolveAddr: rdma_resolve_addr failed");
316314
}
317315
} else {
318316
log("j2c::resolveAddr: cm_listen_id null\n");
@@ -339,7 +337,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1resolveRoute(JNIEnv *env,
339337
log("j2c::resolveRoute: ret %i\n", ret);
340338
} else {
341339
log("j2c::resolveRoute: rdma_resolve_route failed\n");
342-
JNU_ThrowIOExceptionWithLastError(env, "j2c::resolveRoute: rdma_resolve_route failed");
340+
JNU_ThrowIOExceptionWithLastError(
341+
env, "j2c::resolveRoute: rdma_resolve_route failed");
343342
}
344343
} else {
345344
log("j2c::resolveRoute: cm_listen_id null\n");
@@ -422,7 +421,8 @@ JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1connect(
422421
ibv_get_device_guid(cm_listen_id->verbs->device));
423422
} else {
424423
log("j2c::connect: rdma_connect failed\n");
425-
JNU_ThrowIOExceptionWithLastError(env, "j2c::connect: rdma_connect failed");
424+
JNU_ThrowIOExceptionWithLastError(env,
425+
"j2c::connect: rdma_connect failed");
426426
}
427427
} else {
428428
log("j2c:connect: cm_listen_id null\n");
@@ -684,7 +684,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1allocPd(JNIEnv *env,
684684
log("j2c::allocPd: obj_id %llu\n", obj_id);
685685
} else {
686686
log("j2c::allocPd: ibv_alloc_pd failed\n");
687-
JNU_ThrowIOExceptionWithLastError(env, "j2c::allocPd: ibv_alloc_pd failed");
687+
JNU_ThrowIOExceptionWithLastError(env,
688+
"j2c::allocPd: ibv_alloc_pd failed");
688689
}
689690
} else {
690691
log("j2c::allocPd: context null\n");
@@ -716,7 +717,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1createCompChannel(JNIEnv *env,
716717
log("j2c::createCompChannel: obj_id %llu\n", obj_id);
717718
} else {
718719
log("j2c::createCompChannel: ibv_create_comp_channel failed\n");
719-
JNU_ThrowIOExceptionWithLastError(env, "j2c::createCompChannel: ibv_create_comp_channel failed");
720+
JNU_ThrowIOExceptionWithLastError(
721+
env, "j2c::createCompChannel: ibv_create_comp_channel failed");
720722
}
721723
} else {
722724
log("j2c::createCompChannel: context null\n");
@@ -753,7 +755,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1createCQ(
753755
(void *)obj_id, (void *)cq, cq->handle, _ncqe);
754756
} else {
755757
log("j2c::createCQ: ibv_create_cq failed\n");
756-
JNU_ThrowIOExceptionWithLastError(env, "j2c::createCQ: ibv_create_cq failed");
758+
JNU_ThrowIOExceptionWithLastError(env,
759+
"j2c::createCQ: ibv_create_cq failed");
757760
}
758761
} else {
759762
log("j2c::createCQ: context or comp_channel null\n");
@@ -784,7 +787,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1modifyQP(JNIEnv *env,
784787
log("j2c::modify_qp: ret %i\n", ret);
785788
} else {
786789
log("j2c::modify_qp: ibv_modify_qp failed\n");
787-
JNU_ThrowIOExceptionWithReturnCode(env, "j2c::modify_qp: ibv_modify_qp failed", ret);
790+
JNU_ThrowIOExceptionWithReturnCode(
791+
env, "j2c::modify_qp: ibv_modify_qp failed", ret);
788792
}
789793
} else {
790794
log("j2c::modify_qp: queuepair null\n");
@@ -845,7 +849,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1expPrefetchMr(
845849
} else {
846850
log("j2c::expPrefetchMr: ibv_exp_prefetch_mr failed, error %s\n",
847851
strerror(errno));
848-
JNU_ThrowIOExceptionWithLastError(env, "j2c::expPrefetchMr: ibv_exp_prefetch_mr failed");
852+
JNU_ThrowIOExceptionWithLastError(
853+
env, "j2c::expPrefetchMr: ibv_exp_prefetch_mr failed");
849854
}
850855
} else {
851856
log("j2c::expPrefetchMr: mr null\n");
@@ -890,7 +895,7 @@ JNIEXPORT jlong JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1regMr(
890895
}
891896
} else {
892897
log("j2c::regMr: protection null\n");
893-
JNU_ThrowIOException(env, "j2c::regMr: protection null\n");
898+
JNU_ThrowIOException(env, "j2c::regMr: protection null\n");
894899
}
895900

896901
return obj_id;
@@ -914,7 +919,8 @@ JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1deregMr(
914919
log("j2c::deregMr: ret %i\n", ret);
915920
} else {
916921
log("j2c::deregMr: ibv_dereg_failed, error %s\n", strerror(errno));
917-
JNU_ThrowIOExceptionWithReturnCode(env, "j2c::deregMr: ibv_dereg_failed, error", ret);
922+
JNU_ThrowIOExceptionWithReturnCode(
923+
env, "j2c::deregMr: ibv_dereg_failed, error", ret);
918924
}
919925
} else {
920926
log("j2c::deregMr: mr null\n");
@@ -942,7 +948,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1postSend(JNIEnv *env,
942948
// log("j2c::post_send: ret %i\n", ret);
943949
} else {
944950
log("j2c::post_send: ibv_post_send failed %s\n", strerror(ret));
945-
JNU_ThrowIOExceptionWithReturnCode(env, "j2c::post_send: ibv_post_send failed", ret);
951+
JNU_ThrowIOExceptionWithReturnCode(
952+
env, "j2c::post_send: ibv_post_send failed", ret);
946953
}
947954

948955
} else {
@@ -972,7 +979,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1postRecv(JNIEnv *env,
972979
// log("j2c::post_recv: ret %i\n", ret);
973980
} else {
974981
log("j2c::post_recv: ibv_post_recv failed %s\n", strerror(ret));
975-
JNU_ThrowIOExceptionWithReturnCode(env, "j2c::post_recv: ibv_post_recv failed", ret);
982+
JNU_ThrowIOExceptionWithReturnCode(
983+
env, "j2c::post_recv: ibv_post_recv failed", ret);
976984
}
977985
} else {
978986
log("j2c::post_recv: queuepair null\n");
@@ -1213,7 +1221,8 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1getContextNumCompVectors(
12131221
obj_id, num_comp_vectors);
12141222
} else {
12151223
log("j2c::getContextNumCompVectors: failed, obj_id %llu\n", obj_id);
1216-
JNU_ThrowIOException(env, "j2c::getContextNumCompVectors: failed, ibv_context null");
1224+
JNU_ThrowIOException(
1225+
env, "j2c::getContextNumCompVectors: failed, ibv_context null");
12171226
}
12181227

12191228
return num_comp_vectors;

pom.xml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.ibm.disni</groupId>
66
<artifactId>disni</artifactId>
77
<packaging>jar</packaging>
8-
<version>1.9</version>
8+
<version>2.0</version>
99
<name>disni</name>
1010
<description>DiSNI (Direct Storage and Networking Interface) is a Java library for direct storage and networking access from userpace.</description>
1111
<url>http://github.com/zrlio/disni</url>
@@ -108,8 +108,8 @@
108108
</includes>
109109
</resource>
110110
</resources>
111-
<plugins>
112-
<plugin>
111+
<plugins>
112+
<plugin>
113113
<groupId>org.apache.maven.plugins</groupId>
114114
<artifactId>maven-jar-plugin</artifactId>
115115
<version>2.6</version>
@@ -185,34 +185,20 @@
185185
<source>8</source>
186186
<target>8</target>
187187
</configuration>
188-
</plugin>
188+
</plugin>
189189
<plugin>
190190
<groupId>org.apache.rat</groupId>
191191
<artifactId>apache-rat-plugin</artifactId>
192192
<version>0.12</version>
193-
<configuration>
194-
<licenses>
193+
<configuration>
194+
<licenses>
195195
<license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
196196
<licenseFamilyCategory>AL20</licenseFamilyCategory>
197197
<licenseFamilyName>Apache License, 2.0</licenseFamilyName>
198198
</license>
199-
<license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
200-
<licenseFamilyCategory>LGPL2</licenseFamilyCategory>
201-
<licenseFamilyName>Lesser GNU General Public License, version 2.1</licenseFamilyName>
202-
<patterns>
203-
<pattern>This library is free software; you can redistribute it and/or</pattern>
204-
<pattern>modify it under the terms of the GNU Lesser General Public</pattern>
205-
<pattern>version 2.1 of the License, or (at your option) any later version.</pattern>
206-
</patterns>
207-
</license>
208199
</licenses>
209-
<licenseFamilies>
210-
<licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
211-
<familyName>Lesser GNU General Public License, version 2.1</familyName>
212-
</licenseFamily>
213-
</licenseFamilies>
214200
<excludes>
215-
<exclude>libdisni/**/*</exclude>
201+
<exclude>libdisni/**/*.m4</exclude>
216202
</excludes>
217203
</configuration>
218204
</plugin>

0 commit comments

Comments
 (0)