Skip to content

Commit 56a1caf

Browse files
committed
CL: replaced self defined data types by C++ std types
1 parent ef6ffc6 commit 56a1caf

54 files changed

Lines changed: 624 additions & 611 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

source/clients/common/ocs_client_cqueue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ int select_by_queue_state(uint32_t queue_states, lList *exechost_list, lList *qu
588588
if (sge_load_alarm(nullptr, 0, qep, lGetList(qep, QU_load_thresholds), exechost_list, centry_list, nullptr, true)) {
589589
qinstance_state_set_alarm(qep, true);
590590
}
591-
parse_ulong_val(nullptr, &interval, TYPE_TIM, lGetString(qep, QU_suspend_interval), nullptr, 0);
591+
parse_ulong_val(nullptr, &interval, ocs::CEntry::Type::TIME, lGetString(qep, QU_suspend_interval), nullptr, 0);
592592
if (lGetUlong(qep, QU_nsuspend) != 0 && interval != 0 &&
593593
sge_load_alarm(nullptr, 0, qep, lGetList(qep, QU_suspend_thresholds), exechost_list, centry_list, nullptr, false)) {
594594
qinstance_state_set_suspend_alarm(qep, true);

source/clients/qconf/ocs_qconf_centry.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ centry_list_add_del_mod_via_gdi(lList **this_list, lList **answer_list, lList **
483483
error_msg[0] = '\0';
484484
attrname = lGetString(centry_elem, CE_name);
485485

486-
if (!parse_ulong_val(&dval, nullptr, TYPE_DOUBLE, urgency1, error_msg, 199) ||
487-
!parse_ulong_val(&dval, nullptr, TYPE_DOUBLE, urgency2, error_msg, 199)) {
486+
if (!parse_ulong_val(&dval, nullptr, ocs::CEntry::Type::DOUBLE, urgency1, error_msg, 199) ||
487+
!parse_ulong_val(&dval, nullptr, ocs::CEntry::Type::DOUBLE, urgency2, error_msg, 199)) {
488488
answer_list_add_sprintf(answer_list, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR,
489489
MSG_INVALID_CENTRY_PARSE_URGENCY_SS, attrname, error_msg);
490490
DRETURN(false);

source/clients/qconf/ocs_qconf_cqueue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ cqueue_show(lList **answer_list, const lList *qref_pattern_list)
647647
const char *hostname = nullptr;
648648

649649
hostname = lGetHost(qinstance, QU_qhostname);
650-
if (!sge_eval_expression(TYPE_HOST, h_pattern, hostname, nullptr, true, h_pattern_is_expression)) {
650+
if (!sge_eval_expression(ocs::CEntry::Type::HOST, h_pattern, hostname, nullptr, true, h_pattern_is_expression)) {
651651
const char *filename;
652652
spooling_field *fields = sge_build_QU_field_list(true, false);
653653

source/common/basis_types.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,3 @@ typedef char stringT[MAX_STRING_SIZE];
8282

8383
#define MAX_VERIFY_STRING 512
8484

85-
/* types */
86-
/* these are used for complexes */
87-
#define TYPE_INT 1
88-
#define TYPE_FIRST TYPE_INT
89-
#define TYPE_STR 2
90-
#define TYPE_TIM 3
91-
#define TYPE_MEM 4
92-
#define TYPE_BOO 5
93-
#define TYPE_CSTR 6
94-
#define TYPE_HOST 7
95-
#define TYPE_DOUBLE 8
96-
#define TYPE_RESTR 9
97-
#define TYPE_RSMAP 10
98-
#define TYPE_CE_LAST TYPE_RSMAP
99-
100-
/* used in config */
101-
#define TYPE_ACC 11
102-
#define TYPE_LOG 12
103-
#define TYPE_LAST TYPE_LOG
104-

source/common/parse_qsub.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ lList *cull_parse_cmdline(
250250
DRETURN(answer);
251251
}
252252

253-
if (!parse_ulong_val(&ar_id_d, nullptr, TYPE_INT, *sp, nullptr, 0)) {
253+
if (!parse_ulong_val(&ar_id_d, nullptr, ocs::CEntry::Type::INT, *sp, nullptr, 0)) {
254254
answer_list_add(&answer, MSG_PARSE_INVALID_AR_MUSTBEUINT,
255255
STATUS_ESEMANTIC, ANSWER_QUALITY_ERROR);
256256
DRETURN(answer);
@@ -757,7 +757,7 @@ lList *cull_parse_cmdline(
757757

758758
DPRINTF("\"-d %s\"\n", *sp);
759759

760-
if (!parse_ulong_val(nullptr, &timeval, TYPE_TIM, *sp, tmp, sizeof(tmp)-1)) {
760+
if (!parse_ulong_val(nullptr, &timeval, ocs::CEntry::Type::TIME, *sp, tmp, sizeof(tmp)-1)) {
761761
answer_list_add_sprintf(&answer, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR,
762762
MSG_ANSWER_WRONGTIMEFORMATEXSPECIFIEDTODOPTION_S, *sp);
763763
DRETURN(answer);
@@ -1158,7 +1158,7 @@ lList *cull_parse_cmdline(
11581158
DRETURN(answer);
11591159
}
11601160

1161-
if (!parse_ulong_val(&jobshare_d, nullptr, TYPE_INT, *sp, nullptr, 0)) {
1161+
if (!parse_ulong_val(&jobshare_d, nullptr, ocs::CEntry::Type::INT, *sp, nullptr, 0)) {
11621162
answer_list_add(&answer, MSG_PARSE_INVALIDJOBSHAREMUSTBEUINT,
11631163
STATUS_ESEMANTIC, ANSWER_QUALITY_ERROR);
11641164
DRETURN(answer);
@@ -1467,7 +1467,7 @@ lList *cull_parse_cmdline(
14671467
DRETURN(answer);
14681468
}
14691469

1470-
if (!parse_ulong_val(&otickets_d, nullptr, TYPE_INT, *sp, nullptr, 0)) {
1470+
if (!parse_ulong_val(&otickets_d, nullptr, ocs::CEntry::Type::INT, *sp, nullptr, 0)) {
14711471
answer_list_add(&answer, MSG_PARSE_INVALIDOTICKETSMUSTBEUINT,
14721472
STATUS_ESEMANTIC, ANSWER_QUALITY_ERROR);
14731473
DRETURN(answer);
@@ -2336,7 +2336,7 @@ static int sge_parse_checkpoint_interval(
23362336
DENTER(TOP_LAYER);
23372337

23382338
DPRINTF("--------time_string: %s\n", time_str);
2339-
if (!parse_ulong_val(nullptr, &seconds, TYPE_TIM, time_str, nullptr, 0))
2339+
if (!parse_ulong_val(nullptr, &seconds, ocs::CEntry::Type::TIME, time_str, nullptr, 0))
23402340
seconds = 0;
23412341

23422342
DPRINTF("-------- seconds: %d\n", (int) seconds);

source/daemons/execd/exec_job.cc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static int addgrpid_already_in_use(long add_grp_id) {
215215
#endif
216216

217217
static const char *
218-
sge_exec_job_get_limit(dstring *dstr, int limit_nm, const char *limit_name, uint32_t type,
218+
sge_exec_job_get_limit(dstring *dstr, int limit_nm, const char *limit_name, ocs::CEntry::Type type,
219219
const lListElem *master_q, const lListElem *jatep, const lListElem *petep,
220220
const char *qualified_hostname) {
221221
DENTER(TOP_LAYER);
@@ -1181,7 +1181,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
11811181
if (!(lGetUlong(jep, JB_checkpoint_attr) & CHECKPOINT_AT_MINIMUM_INTERVAL)) {
11821182
interval = 0;
11831183
} else {
1184-
parse_ulong_val(nullptr, &interval, TYPE_TIM, lGetString(master_q, QU_min_cpu_interval), nullptr, 0);
1184+
parse_ulong_val(nullptr, &interval, ocs::CEntry::Type::TIME, lGetString(master_q, QU_min_cpu_interval), nullptr, 0);
11851185
interval = MAX(interval, lGetUlong(jep, JB_checkpoint_interval));
11861186
}
11871187
fprintf(fp, "ckpt_interval=%d\n", (int) interval);
@@ -1202,27 +1202,27 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
12021202
\
12031203
{
12041204
DSTRING_STATIC(dstr_limit, 512);
1205-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_vmem, TYPE_MEM);
1206-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_vmem, TYPE_MEM);
1205+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_vmem, ocs::CEntry::Type::MEM);
1206+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_vmem, ocs::CEntry::Type::MEM);
12071207

1208-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_cpu, TYPE_TIM);
1209-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_cpu, TYPE_TIM);
1208+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_cpu, ocs::CEntry::Type::TIME);
1209+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_cpu, ocs::CEntry::Type::TIME);
12101210

1211-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_stack, TYPE_MEM);
1212-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_stack, TYPE_MEM);
1211+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_stack, ocs::CEntry::Type::MEM);
1212+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_stack, ocs::CEntry::Type::MEM);
12131213

1214-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_data, TYPE_MEM);
1215-
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_data, TYPE_MEM);
1214+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(h_data, ocs::CEntry::Type::MEM);
1215+
WRITE_COMPLEX_AND_CONSUMABLE_ATTR(s_data, ocs::CEntry::Type::MEM);
12161216

12171217
// @todo why not use WRITE_COMPLEX_AND_CONSUMABLE_ATTR? Can't they be made consumable?
1218-
WRITE_COMPLEX_ATTR(h_core, TYPE_MEM);
1219-
WRITE_COMPLEX_ATTR(s_core, TYPE_MEM);
1218+
WRITE_COMPLEX_ATTR(h_core, ocs::CEntry::Type::MEM);
1219+
WRITE_COMPLEX_ATTR(s_core, ocs::CEntry::Type::MEM);
12201220

1221-
WRITE_COMPLEX_ATTR(h_rss, TYPE_MEM);
1222-
WRITE_COMPLEX_ATTR(s_rss, TYPE_MEM);
1221+
WRITE_COMPLEX_ATTR(h_rss, ocs::CEntry::Type::MEM);
1222+
WRITE_COMPLEX_ATTR(s_rss, ocs::CEntry::Type::MEM);
12231223

1224-
WRITE_COMPLEX_ATTR(h_fsize, TYPE_MEM);
1225-
WRITE_COMPLEX_ATTR(s_fsize, TYPE_MEM);
1224+
WRITE_COMPLEX_ATTR(h_fsize, ocs::CEntry::Type::MEM);
1225+
WRITE_COMPLEX_ATTR(s_fsize, ocs::CEntry::Type::MEM);
12261226
}
12271227

12281228
{
@@ -1469,7 +1469,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
14691469
{
14701470
uint32_t notify = 0;
14711471
if (lGetBool(jep, JB_notify)) {
1472-
parse_ulong_val(nullptr, &notify, TYPE_TIM, lGetString(master_q, QU_notify), nullptr, 0);
1472+
parse_ulong_val(nullptr, &notify, ocs::CEntry::Type::TIME, lGetString(master_q, QU_notify), nullptr, 0);
14731473
}
14741474
fprintf(fp, "notify=" sge_u32 "\n", notify);
14751475
}

source/daemons/execd/execd_ck_to_do.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static void notify_ptf() {
203203
* @param limit Reference to the variable where the summed limit will be stored.
204204
*/
205205
static void
206-
force_job_rlimit_sum_up_limit(const lListElem *queue, int limit_nm, uint32_t type, int nslots, double &limit) {
206+
force_job_rlimit_sum_up_limit(const lListElem *queue, int limit_nm, ocs::CEntry::Type type, int nslots, double &limit) {
207207
double queue_limit{};
208208
parse_ulong_val(&queue_limit, nullptr, type, lGetString(queue, limit_nm), nullptr, 0);
209209
if (queue_limit == DBL_MAX) {
@@ -323,12 +323,12 @@ static void force_job_rlimit(const char* qualified_hostname)
323323
}
324324
}
325325

326-
force_job_rlimit_sum_up_limit(q, QU_s_cpu, TYPE_TIM, nslots, s_cpu);
327-
force_job_rlimit_sum_up_limit(q, QU_h_cpu, TYPE_TIM, nslots, h_cpu);
328-
force_job_rlimit_sum_up_limit(q, QU_s_rss, TYPE_MEM, nslots, s_rss);
329-
force_job_rlimit_sum_up_limit(q, QU_h_rss, TYPE_MEM, nslots, h_rss);
330-
force_job_rlimit_sum_up_limit(q, QU_s_vmem, TYPE_MEM, nslots, s_vmem);
331-
force_job_rlimit_sum_up_limit(q, QU_h_vmem, TYPE_MEM, nslots, h_vmem);
326+
force_job_rlimit_sum_up_limit(q, QU_s_cpu, ocs::CEntry::Type::TIME, nslots, s_cpu);
327+
force_job_rlimit_sum_up_limit(q, QU_h_cpu, ocs::CEntry::Type::TIME, nslots, h_cpu);
328+
force_job_rlimit_sum_up_limit(q, QU_s_rss, ocs::CEntry::Type::MEM, nslots, s_rss);
329+
force_job_rlimit_sum_up_limit(q, QU_h_rss, ocs::CEntry::Type::MEM, nslots, h_rss);
330+
force_job_rlimit_sum_up_limit(q, QU_s_vmem, ocs::CEntry::Type::MEM, nslots, s_vmem);
331+
force_job_rlimit_sum_up_limit(q, QU_h_vmem, ocs::CEntry::Type::MEM, nslots, h_vmem);
332332
} /* foreach gdil_ep */
333333

334334
// @todo we output the queue name, which might be incorrect, we might have multiple queues on the host
@@ -373,7 +373,7 @@ execd_get_wallclock_limit(const char *qualified_hostname, const lList *gdil_list
373373
clock_val = std::numeric_limits<uint64_t>::max();
374374
} else {
375375
uint32_t timestamp32;
376-
parse_ulong_val(nullptr, &timestamp32, TYPE_TIM, limit, nullptr, 0);
376+
parse_ulong_val(nullptr, &timestamp32, ocs::CEntry::Type::TIME, limit, nullptr, 0);
377377
clock_val = sge_gmt32_to_gmt64(timestamp32);
378378
}
379379

source/daemons/execd/job_report_execd.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ int do_ack(ocs::gdi::ClientServerBase::struct_msg_t *aMsg)
463463
* @return true if a limit was found and processed, false otherwise.
464464
*/
465465
static bool
466-
count_queue_limits(const lListElem *queue, uint32_t type, int limit_nm, bool increase) {
466+
count_queue_limits(const lListElem *queue, ocs::CEntry::Type type, int limit_nm, bool increase) {
467467
// check_queue_limits is a global variable that is used to determine
468468
// whether we need to check queue limits or not.
469469
// @todo: store this once in the ja_task?
@@ -504,12 +504,12 @@ void modify_queue_limits_flag_for_job(const char *qualified_hostname, lListElem
504504
continue;
505505
}
506506

507-
if (count_queue_limits(q, TYPE_TIM, QU_s_cpu, increase) ||
508-
count_queue_limits(q, TYPE_TIM, QU_h_cpu, increase) ||
509-
count_queue_limits(q, TYPE_MEM, QU_s_rss, increase) ||
510-
count_queue_limits(q, TYPE_MEM, QU_h_rss, increase) ||
511-
count_queue_limits(q, TYPE_MEM, QU_s_vmem, increase) ||
512-
count_queue_limits(q, TYPE_MEM, QU_h_vmem, increase)) {
507+
if (count_queue_limits(q, ocs::CEntry::Type::TIME, QU_s_cpu, increase) ||
508+
count_queue_limits(q, ocs::CEntry::Type::TIME, QU_h_cpu, increase) ||
509+
count_queue_limits(q, ocs::CEntry::Type::MEM, QU_s_rss, increase) ||
510+
count_queue_limits(q, ocs::CEntry::Type::MEM, QU_h_rss, increase) ||
511+
count_queue_limits(q, ocs::CEntry::Type::MEM, QU_s_vmem, increase) ||
512+
count_queue_limits(q, ocs::CEntry::Type::MEM, QU_h_vmem, increase)) {
513513
break;
514514
}
515515
}

source/daemons/execd/load_avg.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,11 +869,11 @@ calculate_reserved_memory(lListElem *queue, int nslots, int h_nm, int s_nm)
869869
double lim, h_mem_lim, s_mem_lim;
870870
char err_str[128];
871871

872-
parse_ulong_val(&h_mem_lim, nullptr, TYPE_MEM,
872+
parse_ulong_val(&h_mem_lim, nullptr, ocs::CEntry::Type::MEM,
873873
lGetString(queue, h_nm),
874874
err_str, sizeof(err_str)-1);
875875

876-
parse_ulong_val(&s_mem_lim, nullptr, TYPE_MEM,
876+
parse_ulong_val(&s_mem_lim, nullptr, ocs::CEntry::Type::MEM,
877877
lGetString(queue, s_nm),
878878
err_str, sizeof(err_str)-1);
879879

source/daemons/qmaster/configuration_qmaster.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ check_config(lList **alpp, lListElem *conf) {
553553
}
554554
} else if (!strcmp(name, "auto_user_oticket") || !strcmp(name, "auto_user_fshare")) {
555555
uint32_t uval = 0;
556-
if (!extended_parse_ulong_val(nullptr, &uval, TYPE_INT, value, nullptr, 0, 0, true)) {
556+
if (!extended_parse_ulong_val(nullptr, &uval, ocs::CEntry::Type::INT, value, nullptr, 0, 0, true)) {
557557
ERROR(MSG_CONF_FORMATERRORFORXINYCONFIG_SS, name, value ? value : "(nullptr)");
558558
answer_list_add(alpp, SGE_EVENT, STATUS_EEXIST, ANSWER_QUALITY_ERROR);
559559
DRETURN(STATUS_EEXIST);

0 commit comments

Comments
 (0)