File: slurmdb-perl.h

package info (click to toggle)
slurm-llnl 18.08.5.2-1%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 42,644 kB
  • sloc: ansic: 439,733; exp: 79,435; sh: 8,604; javascript: 6,528; perl: 4,602; makefile: 4,019; python: 1,211
file content (51 lines) | stat: -rw-r--r-- 1,837 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * slurmdb-perl.h - prototypes of msg-hv converting functions
 */

#ifndef _SLURMDB_PERL_H
#define _SLURMDB_PERL_H

#include <msg.h>

#define FETCH_LIST_FIELD(hv, ptr, field) \
	do { \
	    SV** svp; \
	    if ( (svp = hv_fetch (hv, #field, strlen(#field), FALSE)) ) { \
		if(SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) { \
		    ptr->field = slurm_list_create(NULL); \
		    element_av = (AV*)SvRV(*svp); \
		    elements = av_len(element_av) + 1; \
		    for(i = 0; i < elements; i ++) { \
			if((svp = av_fetch(element_av, i, FALSE))) { \
			    str = slurm_xstrdup((char*)SvPV_nolen(*svp)); \
			    slurm_list_append(ptr->field, str); \
			} else { \
			    Perl_warn(aTHX_ "error fetching \"" #field "\" from \"" #ptr "\""); \
			    return -1; \
			} \
		    } \
		} else { \
		    Perl_warn(aTHX_ "\"" #field "\" of \"" #ptr "\" is not an array reference"); \
		    return -1; \
		} \
	    } \
	} while (0)

extern uint64_t slurmdb_find_tres_count_in_string(char *tres_str_in, int id);

extern int av_to_cluster_grouping_list(AV* av, List grouping_list);
extern int hv_to_assoc_cond(HV* hv, slurmdb_assoc_cond_t* assoc_cond);
extern int hv_to_cluster_cond(HV* hv, slurmdb_cluster_cond_t* cluster_cond);
extern int hv_to_job_cond(HV* hv, slurmdb_job_cond_t* job_cond);
extern int hv_to_user_cond(HV* hv, slurmdb_user_cond_t* user_cond);
extern int hv_to_qos_cond(HV* hv, slurmdb_qos_cond_t* qos_cond);

extern int cluster_grouping_list_to_av(List list, AV* av);
extern int cluster_rec_to_hv(slurmdb_cluster_rec_t *rec, HV* hv);
extern int report_cluster_rec_list_to_av(List list, AV* av);
extern int report_user_rec_to_hv(slurmdb_report_user_rec_t *rec, HV* hv);
extern int job_rec_to_hv(slurmdb_job_rec_t *rec, HV* hv);
extern int qos_rec_to_hv(slurmdb_qos_rec_t *rec, HV* hv, List all_qos);


#endif /* _SLURMDB_PERL_H */