~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/spool/flatfile/sge_flatfile_obj.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*___INFO__MARK_BEGIN__*/
 
2
/*************************************************************************
 
3
 *
 
4
 *  The Contents of this file are made available subject to the terms of
 
5
 *  the Sun Industry Standards Source License Version 1.2
 
6
 *
 
7
 *  Sun Microsystems Inc., March, 2001
 
8
 *
 
9
 *
 
10
 *  Sun Industry Standards Source License Version 1.2
 
11
 *  =================================================
 
12
 *  The contents of this file are subject to the Sun Industry Standards
 
13
 *  Source License Version 1.2 (the "License"); You may not use this file
 
14
 *  except in compliance with the License. You may obtain a copy of the
 
15
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
16
 *
 
17
 *  Software provided under this License is provided on an "AS IS" basis,
 
18
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
19
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
20
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
21
 *  See the License for the specific provisions governing your rights and
 
22
 *  obligations concerning the Software.
 
23
 *
 
24
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
25
 *
 
26
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
27
 *
 
28
 *   All Rights Reserved.
 
29
 *
 
30
 ************************************************************************/
 
31
/*___INFO__MARK_END__*/                                   
 
32
 
 
33
#include <string.h>
 
34
#include <strings.h>
 
35
#include <ctype.h>
 
36
 
 
37
#include "msg_common.h"
 
38
#include "rmon/sgermon.h"
 
39
#include "sched/sge_resource_utilizationL.h"
 
40
#include "spool/flatfile/sge_flatfile.h"
 
41
#include "spool/flatfile/msg_spoollib_flatfile.h"
 
42
#include "sgeobj/sge_answer.h"
 
43
#include "sgeobj/sge_attr.h"
 
44
#include "sgeobj/sge_calendar.h"
 
45
#include "sgeobj/sge_centry.h"
 
46
#include "sgeobj/sge_ckpt.h"
 
47
#include "sgeobj/sge_conf.h"
 
48
#include "sgeobj/sge_cqueue.h"
 
49
#include "sgeobj/sge_cuser.h"
 
50
#include "sgeobj/sge_feature.h"
 
51
#include "sgeobj/sge_href.h"
 
52
#include "sgeobj/sge_host.h"
 
53
#include "sgeobj/sge_hgroup.h"
 
54
#include "sgeobj/sge_pe.h"
 
55
#include "sgeobj/sge_resource_quota.h"
 
56
#include "sgeobj/sge_qinstance.h"
 
57
#include "sgeobj/sge_range.h"
 
58
#include "sgeobj/sge_schedd_conf.h"
 
59
#include "sgeobj/sge_sharetree.h"
 
60
#include "sgeobj/sge_str.h"
 
61
#include "sgeobj/sge_subordinate.h"
 
62
#include "sgeobj/sge_usage.h"
 
63
#include "sgeobj/sge_userprj.h"
 
64
#include "sgeobj/sge_userset.h"
 
65
#include "sgeobj/sge_advance_reservation.h"
 
66
#include "sgeobj/sge_qrefL.h"
 
67
#include "sgeobj/sge_jobL.h"
 
68
#include "sgeobj/sge_mailrecL.h"
 
69
#include "uti/sge_log.h"
 
70
#include "uti/sge_string.h"
 
71
 
 
72
/* This file defines variables and functions that are used to create field
 
73
 * lists to pass to the flatfile spooling framework.  The reason that some
 
74
 * field lists are represented as structs and some are represented as
 
75
 * functions is that some field lists are always that same, while others
 
76
 * change depending on the context from which they're called. */
 
77
 
 
78
/* read_func's and write_func's -- signature is defined in
 
79
 * sge_spooling_utilities.h:spooling_field. */
 
80
static void create_spooling_field (
 
81
   spooling_field *field,
 
82
   int nm, 
 
83
   int width, 
 
84
   const char *name, 
 
85
   struct spooling_field *sub_fields, 
 
86
   const void *clientdata, 
 
87
   int (*read_func) (lListElem *ep, int nm, const char *buffer, lList **alp), 
 
88
   int (*write_func) (const lListElem *ep, int nm, dstring *buffer, lList **alp)
 
89
);
 
90
static int read_SC_queue_sort_method(lListElem *ep, int nm,
 
91
                                     const char *buffer, lList **alp);
 
92
static int write_SC_queue_sort_method(const lListElem *ep, int nm,
 
93
                                      dstring *buffer, lList **alp);
 
94
static int read_CF_value(lListElem *ep, int nm, const char *buf,
 
95
                         lList **alp);
 
96
static int read_CQ_ulng_attr_list(lListElem *ep, int nm, const char *buffer,
 
97
                                  lList **alp);
 
98
static int write_CQ_ulng_attr_list(const lListElem *ep, int nm,
 
99
                                   dstring *buffer, lList **alp);
 
100
static int read_CQ_mem_attr_list(lListElem *ep, int nm, const char *buffer,
 
101
                                 lList **alp);
 
102
static int write_CQ_mem_attr_list(const lListElem *ep, int nm,
 
103
                                  dstring *buffer, lList **alp);
 
104
static int read_CQ_time_attr_list(lListElem *ep, int nm, const char *buffer,
 
105
                                  lList **alp);
 
106
static int write_CQ_time_attr_list(const lListElem *ep, int nm,
 
107
                                   dstring *buffer, lList **alp);
 
108
static int read_CQ_prjlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
109
                                     lList **alp);
 
110
static int write_CQ_prjlist_attr_list(const lListElem *ep, int nm,
 
111
                                      dstring *buffer, lList **alp);
 
112
static int read_CQ_solist_attr_list(lListElem *ep, int nm, const char *buffer,
 
113
                                    lList **alp);
 
114
static int write_CQ_solist_attr_list(const lListElem *ep, int nm,
 
115
                                     dstring *buffer, lList **alp);
 
116
static int read_CQ_usrlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
117
                                     lList **alp);
 
118
static int write_CQ_usrlist_attr_list(const lListElem *ep, int nm,
 
119
                                      dstring *buffer, lList **alp);
 
120
static int read_CQ_bool_attr_list(lListElem *ep, int nm, const char *buffer,
 
121
                                  lList **alp);
 
122
static int write_CQ_bool_attr_list(const lListElem *ep, int nm,
 
123
                                   dstring *buffer, lList **alp);
 
124
static int read_CQ_strlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
125
                                     lList **alp);
 
126
static int write_CQ_strlist_attr_list(const lListElem *ep, int nm,
 
127
                                      dstring *buffer, lList **alp);
 
128
static int read_CQ_qtlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
129
                                    lList **alp);
 
130
static int write_CQ_qtlist_attr_list(const lListElem *ep, int nm,
 
131
                                     dstring *buffer, lList **alp);
 
132
static int read_CQ_str_attr_list(lListElem *ep, int nm, const char *buffer,
 
133
                                 lList **alp);
 
134
static int write_CQ_str_attr_list(const lListElem *ep, int nm,
 
135
                                  dstring *buffer, lList **alp);
 
136
static int read_CQ_inter_attr_list(lListElem *ep, int nm, const char *buffer,
 
137
                                   lList **alp);
 
138
static int write_CQ_inter_attr_list(const lListElem *ep, int nm,
 
139
                                    dstring *buffer, lList **alp);
 
140
static int read_CQ_celist_attr_list(lListElem *ep, int nm, const char *buffer,
 
141
                                    lList **alp);
 
142
static int write_CQ_celist_attr_list(const lListElem *ep, int nm,
 
143
                                     dstring *buffer, lList **alp);
 
144
static int read_CQ_hostlist(lListElem *ep, int nm, const char *buffer,
 
145
                            lList **alp);
 
146
static int write_CQ_hostlist(const lListElem *ep, int nm,
 
147
                             dstring *buffer, lList **alp);
 
148
static int write_CE_stringval(const lListElem *ep, int nm, dstring *buffer,
 
149
                       lList **alp);
 
150
static int read_RQR_obj(lListElem *ep, int nm, const char *buffer,
 
151
                                    lList **alp);
 
152
static int write_RQR_obj(const lListElem *ep, int nm, dstring *buffer,
 
153
                       lList **alp);
 
154
 
 
155
/* Field lists for context-independent spooling of sub-lists */
 
156
static spooling_field AMEM_sub_fields[] = {
 
157
   {  AMEM_href,           0, NULL,                NULL, NULL, NULL},
 
158
   {  AMEM_value,          0, NULL,                NULL, NULL, NULL},
 
159
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
160
};
 
161
 
 
162
static spooling_field ATIME_sub_fields[] = {
 
163
   {  ATIME_href,          0, NULL,                NULL, NULL, NULL},
 
164
   {  ATIME_value,         0, NULL,                NULL, NULL, NULL},
 
165
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
166
};
 
167
 
 
168
static spooling_field PR_sub_fields[] = {
 
169
   {  PR_name,             0, NULL,                NULL, NULL, NULL},
 
170
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
171
};
 
172
 
 
173
static spooling_field APRJLIST_sub_fields[] = {
 
174
   {  APRJLIST_href,       0, NULL,                NULL, NULL, NULL},
 
175
   {  APRJLIST_value,      0, NULL,                PR_sub_fields, NULL, NULL},
 
176
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
177
};
 
178
 
 
179
static spooling_field SO_sub_fields[] = {
 
180
   {  SO_name,            11, NULL, NULL, NULL, NULL, NULL},
 
181
   {  SO_threshold,       11, NULL, NULL, NULL, NULL, NULL},
 
182
   {  NoName,             11, NULL, NULL, NULL, NULL, NULL}
 
183
};
 
184
 
 
185
static spooling_field ASOLIST_sub_fields[] = {
 
186
   {  ASOLIST_href,        0, NULL,                NULL, NULL, NULL},
 
187
   {  ASOLIST_value,       0, NULL,                SO_sub_fields, NULL, NULL},
 
188
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
189
};
 
190
 
 
191
static spooling_field US_sub_fields[] = {
 
192
   {  US_name,             0, NULL,                NULL, NULL, NULL},
 
193
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
194
};
 
195
 
 
196
static spooling_field AUSRLIST_sub_fields[] = {
 
197
   {  AUSRLIST_href,       0, NULL,                NULL, NULL, NULL},
 
198
   {  AUSRLIST_value,      0, NULL,                US_sub_fields, NULL, NULL},
 
199
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
200
};
 
201
 
 
202
static spooling_field ABOOL_sub_fields[] = {
 
203
   {  ABOOL_href,          0, NULL,                NULL, NULL, NULL},
 
204
   {  ABOOL_value,         0, NULL,                NULL, NULL, NULL},
 
205
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
206
};
 
207
 
 
208
static spooling_field ST_sub_fields[] = {
 
209
   {  ST_name,             0, NULL,                NULL, NULL, NULL},
 
210
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
211
};
 
212
 
 
213
static spooling_field ASTRLIST_sub_fields[] = {
 
214
   {  ASTRLIST_href,       0, NULL,                NULL, NULL, NULL},
 
215
   {  ASTRLIST_value,      0, NULL,                ST_sub_fields, NULL, NULL},
 
216
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
217
};
 
218
 
 
219
static spooling_field AQTLIST_sub_fields[] = {
 
220
   {  AQTLIST_href,        0, NULL,                NULL, NULL, NULL},
 
221
   {  AQTLIST_value,       0, NULL,                NULL, NULL, NULL},
 
222
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
223
};
 
224
 
 
225
static spooling_field ASTR_sub_fields[] = {
 
226
   {  ASTR_href,           0, NULL,                NULL, NULL, NULL},
 
227
   {  ASTR_value,          0, NULL,                NULL, NULL, NULL},
 
228
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
229
};
 
230
 
 
231
static spooling_field AINTER_sub_fields[] = {
 
232
   {  AINTER_href,         0, NULL,                NULL, NULL, NULL},
 
233
   {  AINTER_value,        0, NULL,                NULL, NULL, NULL},
 
234
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
235
};
 
236
 
 
237
static spooling_field CE_sub_fields[] = {
 
238
   {  CE_name,            11, "name",    NULL, NULL, NULL, NULL},
 
239
   {  CE_stringval,       11, "value",   NULL, NULL, NULL, write_CE_stringval},
 
240
   {  NoName,             11, NULL,      NULL, NULL, NULL, NULL}
 
241
};
 
242
 
 
243
static spooling_field RUE_sub_fields[] = {
 
244
   {  RUE_name,           11, NULL,   NULL, NULL, NULL, NULL},
 
245
   {  RUE_utilized_now,   11, NULL,   NULL, NULL, NULL, NULL},
 
246
   {  NoName,             11, NULL,   NULL, NULL, NULL, NULL}
 
247
};
 
248
 
 
249
static spooling_field ACELIST_sub_fields[] = {
 
250
   {  ACELIST_href,        0, NULL, NULL, NULL, NULL, NULL},
 
251
   {  ACELIST_value,       0, NULL, CE_sub_fields, NULL, NULL, NULL},
 
252
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
253
};
 
254
 
 
255
static spooling_field AULNG_sub_fields[] = {
 
256
   {  AULNG_href,          0, NULL, NULL, NULL, NULL, NULL},
 
257
   {  AULNG_value,         0, NULL, NULL, NULL, NULL, NULL},
 
258
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
259
};
 
260
 
 
261
static spooling_field CF_sub_fields[] = {
 
262
   {  CF_name,             28, NULL, NULL, NULL, NULL, NULL},
 
263
   {  CF_value,            28, NULL, NULL, NULL, read_CF_value, NULL},
 
264
   {  NoName,              28, NULL, NULL, NULL, NULL, NULL}
 
265
};
 
266
 
 
267
static spooling_field STN_sub_fields[] = {
 
268
   {  STN_id,              0, NULL, NULL, NULL, NULL, NULL},
 
269
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
270
};
 
271
 
 
272
static spooling_field HS_sub_fields[] = {
 
273
   {  HS_name,             0, NULL, NULL, NULL, NULL, NULL},
 
274
   {  HS_value,            0, NULL, NULL, NULL, NULL, NULL},
 
275
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
276
};
 
277
 
 
278
static spooling_field RU_sub_fields[] = {
 
279
   {  RU_job_number,         0, NULL, NULL, NULL, NULL, NULL},
 
280
   {  RU_task_number,        0, NULL, NULL, NULL, NULL, NULL},
 
281
   {  RU_state,              0, NULL, NULL, NULL, NULL, NULL},
 
282
   {  NoName,                0, NULL, NULL, NULL, NULL, NULL}
 
283
};
 
284
 
 
285
static spooling_field HL_sub_fields[] = {
 
286
   {  HL_name,             0, NULL, NULL, NULL, NULL, NULL},
 
287
   {  HL_value,            0, NULL, NULL, NULL, NULL, NULL},
 
288
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
289
};
 
290
 
 
291
static spooling_field STU_sub_fields[] = {
 
292
   {  STU_name,            0, NULL, NULL, NULL, NULL, NULL},
 
293
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
294
};
 
295
 
 
296
static spooling_field UE_sub_fields[] = {
 
297
   {  UE_name,             0, NULL, NULL, NULL, NULL, NULL},
 
298
   {  NoName,              0, NULL, NULL, NULL, NULL, NULL}
 
299
};
 
300
 
 
301
static spooling_field UA_sub_fields[] = {
 
302
   {  UA_name,             0, NULL,                NULL, NULL, NULL, NULL},
 
303
   {  UA_value,            0, NULL,                NULL, NULL, NULL, NULL},
 
304
   {  NoName,              0, NULL,                NULL, NULL, NULL, NULL}
 
305
};
 
306
 
 
307
static spooling_field UPP_sub_fields[] = {
 
308
   {  UPP_name,            0, NULL,                NULL, NULL, NULL, NULL},
 
309
   {  UPP_usage,           0, NULL,                UA_sub_fields, NULL, NULL, NULL},
 
310
   {  UPP_long_term_usage, 0, NULL,                UA_sub_fields, NULL, NULL, NULL},
 
311
   {  NoName,              0, NULL,                NULL, NULL, NULL, NULL}
 
312
};
 
313
 
 
314
static spooling_field UPU_sub_fields[] = {
 
315
   {  UPU_job_number,      0, NULL,                NULL, NULL, NULL, NULL},
 
316
   {  UPU_old_usage_list,  0, NULL,                UA_sub_fields, &qconf_sub_name_value_comma_sfi, NULL, NULL},
 
317
   {  NoName,              0, NULL,                NULL, NULL, NULL, NULL}
 
318
};
 
319
 
 
320
static spooling_field HR_sub_fields[] = {
 
321
   {  HR_name,             0, NULL,                NULL, NULL, NULL, NULL},
 
322
   {  NoName,              0, NULL,                NULL, NULL, NULL, NULL}
 
323
};
 
324
 
 
325
static spooling_field RQRL_sub_fields[] = {
 
326
   {  RQRL_name,           0, NULL,                NULL, NULL, NULL, NULL},
 
327
   {  RQRL_value,          0, NULL,                NULL, NULL, NULL, NULL},
 
328
   {  NoName,              0, NULL,                NULL, NULL, NULL, NULL}
 
329
};
 
330
 
 
331
static spooling_field RQR_sub_fields[] = {
 
332
   {  RQR_name,            0, "name",              NULL, NULL, NULL, NULL},
 
333
   {  RQR_filter_users,    0, "users",             NULL, NULL, read_RQR_obj, write_RQR_obj},
 
334
   {  RQR_filter_projects, 0, "projects",          NULL, NULL, read_RQR_obj, write_RQR_obj},
 
335
   {  RQR_filter_pes,      0, "pes",               NULL, NULL, read_RQR_obj, write_RQR_obj},
 
336
   {  RQR_filter_queues,   0, "queues",            NULL, NULL, read_RQR_obj, write_RQR_obj},
 
337
   {  RQR_filter_hosts,    0, "hosts",             NULL, NULL, read_RQR_obj, write_RQR_obj},
 
338
   {  RQR_limit,           0, "to",                RQRL_sub_fields,  &qconf_sub_name_value_comma_sfi, NULL, NULL},
 
339
   {  NoName,              0, NULL,                NULL, NULL, NULL, NULL}
 
340
};
 
341
 
 
342
/* Field lists for context-independent object spooling */
 
343
spooling_field CE_fields[] = {
 
344
   {  CE_name,            11, "name",          NULL, NULL, NULL, NULL},
 
345
   {  CE_shortcut,        11, "shortcut",      NULL, NULL, NULL, NULL},
 
346
   {  CE_valtype,         11, "type",          NULL, NULL, NULL, NULL},
 
347
   {  CE_relop,           11, "relop",         NULL, NULL, NULL, NULL},
 
348
   {  CE_requestable,     11, "requestable",   NULL, NULL, NULL, NULL},
 
349
   {  CE_consumable,      11, "consumable",    NULL, NULL, NULL, NULL},
 
350
   {  CE_default,         11, "default",       NULL, NULL, NULL, NULL},
 
351
   {  CE_urgency_weight,  11, "urgency",       NULL, NULL, NULL, NULL},
 
352
   {  NoName,             11, NULL,            NULL, NULL, NULL, NULL}
 
353
};
 
354
 
 
355
spooling_field CAL_fields[] = {
 
356
   {  CAL_name,           16, "calendar_name", NULL, NULL, NULL, NULL},
 
357
   {  CAL_year_calendar,  16, "year",          NULL, NULL, NULL, NULL},
 
358
   {  CAL_week_calendar,  16, "week",          NULL, NULL, NULL, NULL},
 
359
   {  NoName,             16, NULL,            NULL, NULL, NULL, NULL}
 
360
};
 
361
 
 
362
spooling_field CK_fields[] = {
 
363
   {  CK_name,            18, "ckpt_name",        NULL, NULL, NULL},
 
364
   {  CK_interface,       18, "interface",        NULL, NULL, NULL},
 
365
   {  CK_ckpt_command,    18, "ckpt_command",     NULL, NULL, NULL},
 
366
   {  CK_migr_command,    18, "migr_command",     NULL, NULL, NULL},
 
367
   {  CK_rest_command,    18, "restart_command",  NULL, NULL, NULL},
 
368
   {  CK_clean_command,   18, "clean_command",    NULL, NULL, NULL},
 
369
   {  CK_ckpt_dir,        18, "ckpt_dir",         NULL, NULL, NULL},
 
370
   {  CK_signal,          18, "signal",           NULL, NULL, NULL},
 
371
   {  CK_when,            18, "when",             NULL, NULL, NULL},
 
372
   {  NoName,             18, NULL,               NULL, NULL, NULL}
 
373
};
 
374
 
 
375
spooling_field HGRP_fields[] = {
 
376
   {  HGRP_name,           0, "group_name",        NULL, NULL, NULL},
 
377
   {  HGRP_host_list,      0, "hostlist",          HR_sub_fields, NULL, NULL},
 
378
   {  NoName,              0, NULL,                NULL, NULL, NULL}
 
379
};
 
380
 
 
381
spooling_field US_fields[] = {
 
382
   {  US_name,    7, "name",    NULL,          NULL, NULL, NULL},
 
383
   {  US_type,    7, "type",    NULL,          NULL, NULL, NULL},
 
384
   {  US_fshare,  7, "fshare",  US_sub_fields, NULL, NULL, NULL},
 
385
   {  US_oticket, 7, "oticket", US_sub_fields, NULL, NULL, NULL},
 
386
   {  US_entries, 7, "entries", UE_sub_fields, NULL, NULL, NULL},
 
387
   {  NoName,     7, NULL,      NULL,          NULL, NULL, NULL}
 
388
};
 
389
   
 
390
spooling_field SC_fields[] = {
 
391
   {  SC_algorithm,                       33, "algorithm",                       NULL,          NULL, NULL,                      NULL},
 
392
   {  SC_schedule_interval,               33, "schedule_interval",               NULL,          NULL, NULL,                      NULL},
 
393
   {  SC_maxujobs,                        33, "maxujobs",                        NULL,          NULL, NULL,                      NULL},
 
394
   {  SC_queue_sort_method,               33, "queue_sort_method",               NULL,          NULL, read_SC_queue_sort_method, write_SC_queue_sort_method},
 
395
   {  SC_job_load_adjustments,            33, "job_load_adjustments",            CE_sub_fields, NULL, NULL,                      NULL},
 
396
   {  SC_load_adjustment_decay_time,      33, "load_adjustment_decay_time",      CE_sub_fields, NULL, NULL,                      NULL},
 
397
   {  SC_load_formula,                    33, "load_formula",                    NULL,          NULL, NULL,                      NULL},
 
398
   {  SC_schedd_job_info,                 33, "schedd_job_info",                 NULL,          NULL, NULL,                      NULL},
 
399
   {  SC_flush_submit_sec,                33, "flush_submit_sec",                NULL,          NULL, NULL,                      NULL},
 
400
   {  SC_flush_finish_sec,                33, "flush_finish_sec",                NULL,          NULL, NULL,                      NULL},
 
401
   {  SC_params,                          33, "params",                          NULL,          NULL, NULL,                      NULL},
 
402
   {  SC_reprioritize_interval,           33, "reprioritize_interval",           NULL,          NULL, NULL,                      NULL},
 
403
   {  SC_halftime,                        33, "halftime",                        NULL,          NULL, NULL,                      NULL},
 
404
   {  SC_usage_weight_list,               33, "usage_weight_list",               UA_sub_fields, NULL, NULL,                      NULL},
 
405
   {  SC_compensation_factor,             33, "compensation_factor",             NULL,          NULL, NULL,                      NULL},
 
406
   {  SC_weight_user,                     33, "weight_user",                     NULL,          NULL, NULL,                      NULL},
 
407
   {  SC_weight_project,                  33, "weight_project",                  NULL,          NULL, NULL,                      NULL},
 
408
   {  SC_weight_department,               33, "weight_department",               NULL,          NULL, NULL,                      NULL},
 
409
   {  SC_weight_job,                      33, "weight_job",                      NULL,          NULL, NULL,                      NULL},
 
410
   {  SC_weight_tickets_functional,       33, "weight_tickets_functional",       NULL,          NULL, NULL,                      NULL},
 
411
   {  SC_weight_tickets_share,            33, "weight_tickets_share",            NULL,          NULL, NULL,                      NULL},
 
412
   {  SC_share_override_tickets,          33, "share_override_tickets",          NULL,          NULL, NULL,                      NULL},
 
413
   {  SC_share_functional_shares,         33, "share_functional_shares",         NULL,          NULL, NULL,                      NULL},
 
414
   {  SC_max_functional_jobs_to_schedule, 33, "max_functional_jobs_to_schedule", NULL,          NULL, NULL,                      NULL},
 
415
   {  SC_report_pjob_tickets,             33, "report_pjob_tickets",             NULL,          NULL, NULL,                      NULL},
 
416
   {  SC_max_pending_tasks_per_job,       33, "max_pending_tasks_per_job",       NULL,          NULL, NULL,                      NULL},
 
417
   {  SC_halflife_decay_list,             33, "halflife_decay_list",             NULL,          NULL, NULL,                      NULL},
 
418
   {  SC_policy_hierarchy,                33, "policy_hierarchy",                NULL,          NULL, NULL,                      NULL},
 
419
   {  SC_weight_ticket,                   33, "weight_ticket",                   NULL,          NULL, NULL,                      NULL},
 
420
   {  SC_weight_waiting_time,             33, "weight_waiting_time",             NULL,          NULL, NULL,                      NULL},
 
421
   {  SC_weight_deadline,                 33, "weight_deadline",                 NULL,          NULL, NULL,                      NULL},
 
422
   {  SC_weight_urgency,                  33, "weight_urgency",                  NULL,          NULL, NULL,                      NULL},
 
423
   {  SC_weight_priority,                 33, "weight_priority",                 NULL,          NULL, NULL,                      NULL},
 
424
   {  SC_max_reservation,                 33, "max_reservation",                 NULL,          NULL, NULL,                      NULL},
 
425
   {  SC_default_duration,                33, "default_duration",                NULL,          NULL, NULL,                      NULL},
 
426
   {  NoName,                             33, NULL,                              NULL,          NULL, NULL,                      NULL}
 
427
};
 
428
 
 
429
spooling_field CQ_fields[] = {
 
430
   {  CQ_name,                   21, "qname",              NULL,                NULL,                                   NULL,                      NULL},
 
431
   {  CQ_hostlist,               21, "hostlist",           HR_sub_fields,       NULL,                                   read_CQ_hostlist,          write_CQ_hostlist},
 
432
   {  CQ_seq_no,                 21, "seq_no",             AULNG_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_ulng_attr_list,    write_CQ_ulng_attr_list},
 
433
   {  CQ_load_thresholds,        21, "load_thresholds",    ACELIST_sub_fields,  &qconf_sub_name_value_comma_braced_sfi, read_CQ_celist_attr_list,  write_CQ_celist_attr_list},
 
434
   {  CQ_suspend_thresholds,     21, "suspend_thresholds", ACELIST_sub_fields,  &qconf_sub_name_value_comma_braced_sfi, read_CQ_celist_attr_list,  write_CQ_celist_attr_list},
 
435
   {  CQ_nsuspend,               21, "nsuspend",           AULNG_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_ulng_attr_list,    write_CQ_ulng_attr_list},
 
436
   {  CQ_suspend_interval,       21, "suspend_interval",   AINTER_sub_fields,   &qconf_sub_name_value_comma_braced_sfi, read_CQ_inter_attr_list,   write_CQ_inter_attr_list},
 
437
   {  CQ_priority,               21, "priority",           ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
438
   {  CQ_min_cpu_interval,       21, "min_cpu_interval",   AINTER_sub_fields,   &qconf_sub_name_value_comma_braced_sfi, read_CQ_inter_attr_list,   write_CQ_inter_attr_list},
 
439
   {  CQ_processors,             21, "processors",         ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
440
   {  CQ_qtype,                  21, "qtype",              AQTLIST_sub_fields,  &qconf_sub_name_value_comma_braced_sfi, read_CQ_qtlist_attr_list,  write_CQ_qtlist_attr_list},
 
441
   {  CQ_ckpt_list,              21, "ckpt_list",          ASTRLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_strlist_attr_list, write_CQ_strlist_attr_list},
 
442
   {  CQ_pe_list,                21, "pe_list",            ASTRLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_strlist_attr_list, write_CQ_strlist_attr_list},
 
443
   {  CQ_rerun,                  21, "rerun",              ABOOL_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_bool_attr_list,    write_CQ_bool_attr_list},
 
444
   {  CQ_job_slots,              21, "slots",              AULNG_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_ulng_attr_list,    write_CQ_ulng_attr_list},
 
445
   {  CQ_tmpdir,                 21, "tmpdir",             ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
446
   {  CQ_shell,                  21, "shell",              ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
447
   {  CQ_prolog,                 21, "prolog",             ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
448
   {  CQ_epilog,                 21, "epilog",             ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
449
   {  CQ_shell_start_mode,       21, "shell_start_mode",   ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
450
   {  CQ_starter_method,         21, "starter_method",     ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
451
   {  CQ_suspend_method,         21, "suspend_method",     ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
452
   {  CQ_resume_method,          21, "resume_method",      ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
453
   {  CQ_terminate_method,       21, "terminate_method",   ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
454
   {  CQ_notify,                 21, "notify",             AINTER_sub_fields,   &qconf_sub_name_value_comma_braced_sfi, read_CQ_inter_attr_list,   write_CQ_inter_attr_list},
 
455
   {  CQ_owner_list,             21, "owner_list",         AUSRLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_usrlist_attr_list, write_CQ_usrlist_attr_list},
 
456
   {  CQ_acl,                    21, "user_lists",         AUSRLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_usrlist_attr_list, write_CQ_usrlist_attr_list},
 
457
   {  CQ_xacl,                   21, "xuser_lists",        AUSRLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_usrlist_attr_list, write_CQ_usrlist_attr_list},
 
458
   {  CQ_subordinate_list,       21, "subordinate_list",   ASOLIST_sub_fields,  &qconf_sub_name_value_comma_braced_sfi, read_CQ_solist_attr_list,  write_CQ_solist_attr_list},
 
459
   {  CQ_consumable_config_list, 21, "complex_values",     ACELIST_sub_fields,  &qconf_sub_name_value_comma_braced_sfi, read_CQ_celist_attr_list,  write_CQ_celist_attr_list},
 
460
   {  CQ_projects,               21, "projects",           APRJLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_prjlist_attr_list, write_CQ_prjlist_attr_list},
 
461
   {  CQ_xprojects,              21, "xprojects",          APRJLIST_sub_fields, &qconf_sub_name_value_comma_braced_sfi, read_CQ_prjlist_attr_list, write_CQ_prjlist_attr_list},
 
462
   {  CQ_calendar,               21, "calendar",           ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
463
   {  CQ_initial_state,          21, "initial_state",      ASTR_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_str_attr_list,     write_CQ_str_attr_list},
 
464
   {  CQ_s_rt,                   21, "s_rt",               ATIME_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_time_attr_list,    write_CQ_time_attr_list},
 
465
   {  CQ_h_rt,                   21, "h_rt",               ATIME_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_time_attr_list,    write_CQ_time_attr_list},
 
466
   {  CQ_s_cpu,                  21, "s_cpu",              ATIME_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_time_attr_list,    write_CQ_time_attr_list},
 
467
   {  CQ_h_cpu,                  21, "h_cpu",              ATIME_sub_fields,    &qconf_sub_name_value_comma_braced_sfi, read_CQ_time_attr_list,    write_CQ_time_attr_list},
 
468
   {  CQ_s_fsize,                21, "s_fsize",            AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
469
   {  CQ_h_fsize,                21, "h_fsize",            AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
470
   {  CQ_s_data,                 21, "s_data",             AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
471
   {  CQ_h_data,                 21, "h_data",             AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
472
   {  CQ_s_stack,                21, "s_stack",            AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
473
   {  CQ_h_stack,                21, "h_stack",            AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
474
   {  CQ_s_core,                 21, "s_core",             AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
475
   {  CQ_h_core,                 21, "h_core",             AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
476
   {  CQ_s_rss,                  21, "s_rss",              AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
477
   {  CQ_h_rss,                  21, "h_rss",              AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
478
   {  CQ_s_vmem,                 21, "s_vmem",             AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
479
   {  CQ_h_vmem,                 21, "h_vmem",             AMEM_sub_fields,     &qconf_sub_name_value_comma_braced_sfi, read_CQ_mem_attr_list,     write_CQ_mem_attr_list},
 
480
   {  NoName,                    21, NULL,                 NULL,                NULL,                                   NULL,                      NULL}
 
481
};
 
482
 
 
483
spooling_field CU_fields[] = {
 
484
   {  CU_name,           0, "cluster user",         NULL},
 
485
   {  CU_ruser_list,     0, "remote user",          ASTR_sub_fields},
 
486
   {  CU_ulong32,        0, "ulong32",              AULNG_sub_fields},
 
487
   {  CU_bool,           0, "bool",                 ABOOL_sub_fields},
 
488
   {  CU_time,           0, "time",                 ATIME_sub_fields},
 
489
   {  CU_mem,            0, "mem",                  AMEM_sub_fields},
 
490
   {  CU_inter,          0, "inter",                AINTER_sub_fields},
 
491
   {  NoName,            0, NULL,                   NULL}
 
492
};
 
493
 
 
494
spooling_field SH_fields[] = {
 
495
   {  SH_name,           21, "hostname",   NULL, NULL, NULL, NULL},
 
496
   {  NoName,            21, NULL,         NULL, NULL, NULL, NULL}
 
497
};
 
498
 
 
499
spooling_field AH_fields[] = {
 
500
   {  AH_name,           21, "hostname",   NULL, NULL, NULL, NULL},
 
501
   {  NoName,            21, NULL,         NULL, NULL, NULL, NULL}
 
502
};
 
503
 
 
504
static spooling_field RN_sub_fields[] = {
 
505
   {  RN_min,             0, NULL,                NULL, NULL, NULL, NULL},
 
506
   {  RN_max,             0, NULL,                NULL, NULL, NULL, NULL},
 
507
   {  RN_step,             0, NULL,                NULL, NULL, NULL, NULL},
 
508
   {  NoName,             0, NULL,                NULL, NULL, NULL, NULL}
 
509
};
 
510
 
 
511
static spooling_field QR_sub_fields[] = {
 
512
   {  QR_name,             0, NULL,                NULL, NULL, NULL, NULL},
 
513
   {  NoName,             0, NULL,                NULL, NULL, NULL, NULL}
 
514
};
 
515
 
 
516
static spooling_field JG_sub_fields[] = {
 
517
   {  JG_qname,             0, NULL,                NULL, NULL, NULL, NULL},
 
518
   {  JG_slots,             0, NULL,                NULL, NULL, NULL, NULL},
 
519
   {  NoName,             0, NULL,                NULL, NULL, NULL, NULL}
 
520
};
 
521
 
 
522
static spooling_field MR_sub_fields[] = {
 
523
   {  MR_user,             0, NULL,                NULL, NULL, NULL, NULL},
 
524
   {  MR_host,             0, NULL,                NULL, NULL, NULL, NULL},
 
525
   {  NoName,             0, NULL,                NULL, NULL, NULL, NULL}
 
526
};
 
527
 
 
528
static spooling_field ARA_sub_fields[] = {
 
529
   {  ARA_name,             0, NULL,                NULL, NULL, NULL, NULL},
 
530
   {  ARA_group,             0, NULL,                NULL, NULL, NULL, NULL},
 
531
   {  NoName,             0, NULL,                NULL, NULL, NULL, NULL}
 
532
};
 
533
 
 
534
spooling_field AR_fields[] = {
 
535
   {  AR_id,              20,   "id",                NULL, NULL, NULL},
 
536
   {  AR_name,            20,   "name",              NULL, NULL, NULL},
 
537
   {  AR_account,         20,   "account",           NULL, NULL, NULL},
 
538
   {  AR_owner,           20,   "owner",             NULL, NULL, NULL},
 
539
   {  AR_group,           20,   "group",             NULL, NULL, NULL},
 
540
   {  AR_submission_time, 20,   "submission_time",   NULL, NULL, NULL},
 
541
   {  AR_start_time,      20,   "start_time",        NULL, NULL, NULL},
 
542
   {  AR_end_time,        20,   "end_time",          NULL, NULL, NULL},
 
543
   {  AR_duration,        20,   "duration",          NULL, NULL, NULL},
 
544
   {  AR_verify,          20,   "verify",            NULL, NULL, NULL},
 
545
   {  AR_error_handling,  20,   "error_handling",    NULL, NULL, NULL},
 
546
   {  AR_state,           20,   "state",             NULL, NULL, NULL},
 
547
   {  AR_checkpoint_name, 20,   "checkpoint_name",   NULL, NULL, NULL},
 
548
   {  AR_resource_list,   20,   "resource_list",     CE_sub_fields, &qconf_sub_name_value_comma_sfi, NULL},
 
549
   {  AR_queue_list,      20,   "queue_list",        QR_sub_fields, NULL, NULL},
 
550
   {  AR_granted_slots,   20,   "granted_slots",     JG_sub_fields, &qconf_sub_name_value_comma_sfi, NULL},
 
551
   {  AR_mail_options,    20,   "mail_options",      NULL, NULL, NULL},
 
552
   {  AR_mail_list,       20,   "mail_list",         MR_sub_fields, &qconf_sub_name_value_comma_sfi, NULL},
 
553
   {  AR_pe,              20,   "pe",                NULL, NULL, NULL},
 
554
   {  AR_pe_range,        20,   "pe_range",          RN_sub_fields, &qconf_sub_name_value_comma_sfi, NULL, NULL},
 
555
   {  AR_granted_pe,      20,   "granted_pe",        NULL, NULL, NULL},
 
556
   {  AR_master_queue_list, 20, "master_queue_list", QR_sub_fields, NULL, NULL},
 
557
   {  AR_acl_list,        20,   "acl_list",          ARA_sub_fields, &qconf_sub_name_value_comma_sfi, NULL},
 
558
   {  AR_xacl_list,       20,   "xacl_list",         ARA_sub_fields, &qconf_sub_name_value_comma_sfi, NULL},
 
559
   {  AR_type,            20,   "type",              NULL, NULL, NULL},
 
560
   {  NoName,             20,   NULL,                NULL, NULL, NULL}
 
561
};
 
562
 
 
563
spooling_field PE_fields[] = {
 
564
   {  PE_name,            18,   "pe_name",           NULL, NULL, NULL},
 
565
   {  PE_slots,           18,   "slots",             NULL, NULL, NULL},
 
566
   {  PE_user_list,       18,   "user_lists",        US_sub_fields, NULL, NULL},
 
567
   {  PE_xuser_list,      18,   "xuser_lists",       US_sub_fields, NULL, NULL},
 
568
   {  PE_start_proc_args, 18,   "start_proc_args",   NULL, NULL, NULL},
 
569
   {  PE_stop_proc_args,  18,   "stop_proc_args",    NULL, NULL, NULL},
 
570
   {  PE_allocation_rule, 18,   "allocation_rule",   NULL, NULL, NULL},
 
571
   {  PE_control_slaves,  18,   "control_slaves",    NULL, NULL, NULL},
 
572
   {  PE_job_is_first_task, 18,   "job_is_first_task", NULL, NULL, NULL},
 
573
   {  PE_urgency_slots,   18,   "urgency_slots",     NULL, NULL, NULL},
 
574
#ifdef SGE_PQS_API
 
575
   {  PE_qsort_args,      18,   "qsort_args",        NULL, NULL, NULL},
 
576
#endif
 
577
   {  PE_accounting_summary, 18,   "accounting_summary", NULL, NULL, NULL},
 
578
   {  NoName,             18,   NULL,                NULL, NULL, NULL}
 
579
};
 
580
 
 
581
spooling_field RQS_fields[] = {
 
582
   {  RQS_name,           12,   "name",              NULL, NULL, NULL},
 
583
   {  RQS_description,    12,   "description",       NULL, NULL, NULL},
 
584
   {  RQS_enabled,        12,   "enabled",           NULL, NULL, NULL},
 
585
   {  RQS_rule,           12,   "limit",             RQR_sub_fields, &qconf_sub_rqs_sfi, NULL},
 
586
   {  NoName,             12,   NULL,                NULL, NULL, NULL}
 
587
};
 
588
 
 
589
static void create_spooling_field (
 
590
   spooling_field *field,
 
591
   int nm, 
 
592
   int width, 
 
593
   const char *name, 
 
594
   struct spooling_field *sub_fields, 
 
595
   const void *clientdata, 
 
596
   int (*read_func) (lListElem *ep, int nm, const char *buffer, lList **alp), 
 
597
   int (*write_func) (const lListElem *ep, int nm, dstring *buffer, lList **alp)
 
598
)
 
599
{
 
600
   if (field != NULL) {
 
601
      field->nm = nm;
 
602
      field->width = width;
 
603
      field->name = name;
 
604
      field->sub_fields = sub_fields;
 
605
      field->clientdata = clientdata;
 
606
      field->read_func = read_func;
 
607
      field->write_func = write_func;
 
608
   }
 
609
}
 
610
 
 
611
spooling_field *sge_build_PR_field_list(bool spool)
 
612
{
 
613
   /* There are 11 possible PR_Type fields. */
 
614
   spooling_field *fields = (spooling_field *)malloc(sizeof(spooling_field)*11);
 
615
   int count = 0;
 
616
   
 
617
   /* Build the list of fields to read and write */
 
618
   create_spooling_field(&fields[count++], PR_name, 0, "name", NULL,
 
619
                          NULL, NULL, NULL);
 
620
   create_spooling_field(&fields[count++], PR_oticket, 0, "oticket",
 
621
                          NULL, NULL, NULL, NULL);
 
622
   create_spooling_field(&fields[count++], PR_fshare, 0, "fshare",
 
623
                          NULL, NULL, NULL, NULL);
 
624
   if (spool) {
 
625
      create_spooling_field(&fields[count++], PR_usage, 0, "usage",
 
626
                             UA_sub_fields, &qconf_sub_name_value_space_sfi, NULL, NULL);
 
627
      create_spooling_field(&fields[count++], PR_usage_time_stamp, 0, "usage_time_stamp",
 
628
                             NULL, NULL, NULL, NULL);
 
629
      create_spooling_field(&fields[count++], PR_long_term_usage, 0, "long_term_usage",
 
630
                             UA_sub_fields, &qconf_sub_name_value_space_sfi, NULL, NULL);
 
631
      create_spooling_field(&fields[count++], PR_project, 0, "project",
 
632
                             UPP_sub_fields,  &qconf_sub_spool_usage_sfi, NULL, NULL);
 
633
   }
 
634
   create_spooling_field(&fields[count++], PR_acl, 0, "acl", US_sub_fields,
 
635
                          NULL, NULL, NULL);
 
636
   create_spooling_field(&fields[count++], PR_xacl, 0, "xacl",
 
637
                          US_sub_fields, NULL, NULL, NULL);
 
638
   if (spool) {
 
639
      create_spooling_field(&fields[count++], PR_debited_job_usage, 0, "debited_job_usage",
 
640
                             UPU_sub_fields, &qconf_sub_spool_usage_sfi, NULL, NULL);
 
641
   }
 
642
   create_spooling_field(&fields[count++], NoName, 0, NULL, NULL, NULL, NULL,
 
643
                          NULL);
 
644
   
 
645
   return fields;
 
646
}
 
647
 
 
648
spooling_field *sge_build_UU_field_list(bool spool)
 
649
{
 
650
   /* There are 11 possible UU_Type fields. */
 
651
   spooling_field *fields = (spooling_field *)malloc(sizeof(spooling_field)*11);
 
652
   int count = 0;
 
653
   
 
654
   /* Build the list of fields to read and write */
 
655
   create_spooling_field(&fields[count++], UU_name, 0, "name", NULL,
 
656
                          NULL, NULL, NULL);
 
657
   create_spooling_field(&fields[count++], UU_oticket, 0, "oticket",
 
658
                          NULL, NULL, NULL, NULL);
 
659
   create_spooling_field(&fields[count++], UU_fshare, 0, "fshare",
 
660
                          NULL, NULL, NULL, NULL);
 
661
   create_spooling_field(&fields[count++], UU_delete_time, 0,
 
662
                             "delete_time", NULL, NULL, NULL, NULL);
 
663
   if (spool) {
 
664
      create_spooling_field(&fields[count++], UU_usage, 0, "usage",
 
665
                             UA_sub_fields, &qconf_sub_name_value_space_sfi, NULL, NULL);
 
666
      create_spooling_field(&fields[count++], UU_usage_time_stamp, 0, "usage_time_stamp",
 
667
                             NULL, NULL, NULL, NULL);
 
668
      create_spooling_field(&fields[count++], UU_long_term_usage, 0, "long_term_usage",
 
669
                             UA_sub_fields, &qconf_sub_name_value_space_sfi, NULL, NULL);
 
670
      create_spooling_field(&fields[count++], UU_project, 0, "project",
 
671
                             UPP_sub_fields, &qconf_sub_spool_usage_sfi, NULL, NULL);
 
672
   }
 
673
   create_spooling_field(&fields[count++], UU_default_project, 0,
 
674
                             "default_project", NULL, NULL, NULL, NULL);
 
675
   if (spool) {
 
676
      create_spooling_field(&fields[count++], UU_debited_job_usage, 0, "debited_job_usage",
 
677
                             UPU_sub_fields, &qconf_sub_spool_usage_sfi, NULL, NULL);
 
678
   }
 
679
   create_spooling_field(&fields[count++], NoName, 0, NULL, NULL, NULL, NULL,
 
680
                          NULL);
 
681
   
 
682
   return fields;
 
683
}
 
684
 
 
685
spooling_field *sge_build_STN_field_list(bool spool, bool recurse)
 
686
{
 
687
   /* There are 7 possible STN_Type fields. */
 
688
   spooling_field *fields = (spooling_field *)malloc (sizeof(spooling_field)*7);
 
689
   int count = 0;
 
690
 
 
691
   if (recurse) {
 
692
      create_spooling_field (&fields[count++], STN_id, 0, "id", NULL,
 
693
                             NULL, NULL, NULL);
 
694
   }
 
695
  
 
696
   if (spool) {
 
697
      create_spooling_field (&fields[count++], STN_version, 0, "version",
 
698
                             NULL, NULL, NULL, NULL);
 
699
   }
 
700
 
 
701
   create_spooling_field (&fields[count++], STN_name, 0, "name", NULL,
 
702
                          NULL, NULL, NULL);
 
703
   create_spooling_field (&fields[count++], STN_type, 0, "type", NULL,
 
704
                          NULL, NULL, NULL);
 
705
   create_spooling_field (&fields[count++], STN_shares, 0, "shares",
 
706
                          NULL, NULL, NULL, NULL);
 
707
   
 
708
   if (recurse) {
 
709
      create_spooling_field (&fields[count++], STN_children, 0, "childnodes",
 
710
                             STN_sub_fields, NULL, NULL, NULL);
 
711
   }
 
712
   
 
713
   create_spooling_field (&fields[count++], NoName, 0, NULL, NULL, NULL, NULL,
 
714
                          NULL);
 
715
   
 
716
   return fields;
 
717
}
 
718
 
 
719
/* The spool_flatfile_read_object() function will fail to read the
 
720
 * EH_reschedule_unknown_list field from a classic spooling file because
 
721
 * classic spooling uses two different field delimiters to represent the
 
722
 * field values. */
 
723
spooling_field *sge_build_EH_field_list(bool spool, bool to_stdout,
 
724
                                        bool history)
 
725
{
 
726
   /* There are 14 possible EH_Type fields. */
 
727
   spooling_field *fields = (spooling_field *)malloc(sizeof(spooling_field)*14);
 
728
   int count = 0;
 
729
 
 
730
   create_spooling_field(&fields[count++], EH_name, 21, "hostname",
 
731
                          NULL, NULL, NULL, NULL);
 
732
   create_spooling_field(&fields[count++], EH_scaling_list, 21, "load_scaling",
 
733
                          HS_sub_fields, &qconf_sub_name_value_comma_sfi, NULL,
 
734
                          NULL);
 
735
   create_spooling_field(&fields[count++], EH_consumable_config_list, 21,
 
736
                          "complex_values", CE_sub_fields,
 
737
                          &qconf_sub_name_value_comma_sfi, NULL, NULL);
 
738
   
 
739
   if (getenv("MORE_INFO")) {
 
740
      create_spooling_field(&fields[count++], EH_resource_utilization, 21,
 
741
                             "complex_values_actual", RUE_sub_fields,
 
742
                             &qconf_sub_name_value_comma_sfi, NULL, NULL);
 
743
   }
 
744
   
 
745
   if (spool || (!spool && to_stdout) || history) {
 
746
      create_spooling_field(&fields[count++], EH_load_list, 21, "load_values",
 
747
                             HL_sub_fields, &qconf_sub_name_value_comma_sfi,
 
748
                             NULL, NULL);
 
749
      create_spooling_field(&fields[count++], EH_processors, 21, "processors",
 
750
                             NULL, NULL, NULL, NULL);
 
751
   }
 
752
 
 
753
   if (spool) {
 
754
      create_spooling_field(&fields[count++], EH_reschedule_unknown_list, 21,
 
755
                             "reschedule_unknown_list", RU_sub_fields,
 
756
                             &qconf_sub_name_value_comma_sfi, NULL, NULL);
 
757
   }
 
758
   
 
759
   create_spooling_field(&fields[count++], EH_acl, 21, "user_lists",
 
760
                          US_sub_fields, NULL, NULL, NULL);
 
761
   create_spooling_field(&fields[count++], EH_xacl, 21, "xuser_lists",
 
762
                          US_sub_fields, NULL, NULL, NULL);
 
763
   
 
764
   create_spooling_field(&fields[count++], EH_prj, 21, "projects",
 
765
                          PR_sub_fields, NULL, NULL, NULL);
 
766
   create_spooling_field(&fields[count++], EH_xprj, 21, "xprojects",
 
767
                          PR_sub_fields, NULL, NULL, NULL);
 
768
   create_spooling_field(&fields[count++], EH_usage_scaling_list, 21,
 
769
                          "usage_scaling", HS_sub_fields,
 
770
                          &qconf_sub_name_value_comma_sfi, NULL, NULL);
 
771
   create_spooling_field(&fields[count++], EH_report_variables, 21, 
 
772
                          "report_variables", STU_sub_fields, 
 
773
                          &qconf_sub_name_value_comma_sfi, NULL, NULL);
 
774
   create_spooling_field(&fields[count++], NoName, 21, NULL, NULL, NULL, NULL,
 
775
                          NULL);
 
776
   
 
777
   return fields;
 
778
}
 
779
 
 
780
static int read_SC_queue_sort_method(lListElem *ep, int nm,
 
781
                                     const char *buffer, lList **alp)
 
782
{
 
783
   if (!strncasecmp(buffer, "load", 4)) {
 
784
      lSetUlong(ep, nm, QSM_LOAD);
 
785
   } else if (!strncasecmp(buffer, "seqno", 5)) {
 
786
      lSetUlong(ep, nm, QSM_SEQNUM);
 
787
   }
 
788
   
 
789
   return 1;
 
790
}
 
791
 
 
792
static int write_SC_queue_sort_method(const lListElem *ep, int nm,
 
793
                                      dstring *buffer, lList **alp)
 
794
{
 
795
   if (lGetUlong(ep, nm) == QSM_SEQNUM) {
 
796
      sge_dstring_append(buffer, "seqno");
 
797
   } else {
 
798
      sge_dstring_append(buffer, "load");
 
799
   }
 
800
 
 
801
   return 1;
 
802
}
 
803
 
 
804
static int read_CF_value(lListElem *ep, int nm, const char *buf,
 
805
                         lList **alp)
 
806
{
 
807
   const char *name = lGetString(ep, CF_name);
 
808
   char *value = NULL;
 
809
   char *buffer = strdup(buf);
 
810
   struct saved_vars_s *context = NULL;
 
811
 
 
812
   DENTER(TOP_LAYER, "read_CF_value");
 
813
   
 
814
   if (!strcmp(name, "gid_range")) {
 
815
      if ((value = sge_strtok_r(buffer, " \t\n", &context))) {
 
816
         if (!strcasecmp(value, NONE_STR)) {
 
817
            lSetString(ep, CF_value, value);
 
818
         } else {
 
819
            lList *rlp = NULL;
 
820
            
 
821
            range_list_parse_from_string(&rlp, alp, value, 
 
822
                                         false, false, INF_NOT_ALLOWED);
 
823
            if (rlp == NULL) {
 
824
               WARNING((SGE_EVENT, MSG_CONFIG_CONF_INCORRECTVALUEFORCONFIGATTRIB_SS, 
 
825
                        name, value));
 
826
   
 
827
               sge_free_saved_vars(context);
 
828
               FREE(buffer);
 
829
               DRETURN(0);
 
830
            } else {
 
831
               lListElem *rep;
 
832
 
 
833
               for_each(rep, rlp) {
 
834
                  u_long32 min;
 
835
 
 
836
                  min = lGetUlong(rep, RN_min);
 
837
                  if (min < GID_RANGE_NOT_ALLOWED_ID) {
 
838
                     WARNING((SGE_EVENT, MSG_CONFIG_CONF_GIDRANGELESSTHANNOTALLOWED_I, GID_RANGE_NOT_ALLOWED_ID));
 
839
   
 
840
                     sge_free_saved_vars(context);
 
841
                     FREE(buffer);
 
842
                     lFreeList(&rlp);
 
843
                     DRETURN(0);
 
844
                  }                  
 
845
               }
 
846
               lFreeList(&rlp);
 
847
               lSetString(ep, CF_value, value);
 
848
            }
 
849
         }
 
850
      }
 
851
   } else if (!strcmp(name, "admin_user")) {
 
852
      value = sge_strtok_r(buffer, " \t\n", &context);
 
853
      while (value[0] && isspace((int)value[0]))
 
854
         value++;
 
855
      if (value) {
 
856
         lSetString(ep, CF_value, value);
 
857
      } else {
 
858
         WARNING((SGE_EVENT, MSG_CONFIG_CONF_NOVALUEFORCONFIGATTRIB_S, name));
 
859
   
 
860
         sge_free_saved_vars(context);
 
861
         FREE(buffer);
 
862
         DRETURN(0);
 
863
      }
 
864
   } else if (!strcmp(name, "user_lists") || 
 
865
      !strcmp(name, "xuser_lists") || 
 
866
      !strcmp(name, "projects") || 
 
867
      !strcmp(name, "xprojects") || 
 
868
      !strcmp(name, "prolog") || 
 
869
      !strcmp(name, "epilog") || 
 
870
      !strcmp(name, "starter_method") || 
 
871
      !strcmp(name, "suspend_method") || 
 
872
      !strcmp(name, "resume_method") || 
 
873
      !strcmp(name, "terminate_method") || 
 
874
      !strcmp(name, "qmaster_params") || 
 
875
      !strcmp(name, "execd_params") || 
 
876
      !strcmp(name, "reporting_params") || 
 
877
      !strcmp(name, "qlogin_command") ||
 
878
      !strcmp(name, "rlogin_command") ||
 
879
      !strcmp(name, "rsh_command") ||
 
880
      !strcmp(name, "qlogin_daemon") ||
 
881
      !strcmp(name, "rlogin_daemon") ||
 
882
      !strcmp(name, "rsh_daemon") ||
 
883
      !strcmp(name, "libjvm_path") ||
 
884
      !strcmp(name, "additional_jvm_args")) {
 
885
      if (!(value = sge_strtok_r(buffer, "\t\n", &context))) {
 
886
         /* return line if value is empty */
 
887
         WARNING((SGE_EVENT, MSG_CONFIG_CONF_NOVALUEFORCONFIGATTRIB_S, name));
 
888
   
 
889
         sge_free_saved_vars(context);
 
890
         FREE(buffer);
 
891
         DRETURN(0);
 
892
      }
 
893
      /* skip leading delimitors */
 
894
      while (value[0] && isspace((int)value[0]))
 
895
         value++;
 
896
 
 
897
      lSetString(ep, CF_value, value);
 
898
   } else {
 
899
      if (!(value = sge_strtok_r(buffer, " \t\n", &context))) {
 
900
         WARNING((SGE_EVENT, MSG_CONFIG_CONF_NOVALUEFORCONFIGATTRIB_S, name));
 
901
   
 
902
         sge_free_saved_vars(context);
 
903
         FREE(buffer);
 
904
         DRETURN(0);
 
905
      }
 
906
      if (strcmp(name, "auto_user_oticket") == 0 || 
 
907
              strcmp(name, "auto_user_fshare") == 0 ) {
 
908
         char *end_ptr = NULL;
 
909
         double dbl_value;
 
910
 
 
911
         dbl_value = strtod(value, &end_ptr);
 
912
         if ( dbl_value < 0) {
 
913
            answer_list_add_sprintf(alp, STATUS_EUNKNOWN,
 
914
                                 ANSWER_QUALITY_ERROR,
 
915
                                 MSG_MUST_BE_POSITIVE_VALUE_S,
 
916
                                 name);
 
917
            DRETURN(0);
 
918
         }            
 
919
      } 
 
920
      lSetString(ep, CF_value, value);
 
921
 
 
922
      if (sge_strtok_r(NULL, " \t\n", &context)) {
 
923
         /* Allow only one value per line */
 
924
         WARNING((SGE_EVENT, MSG_CONFIG_CONF_ONLYSINGLEVALUEFORCONFIGATTRIB_S,
 
925
                  name));
 
926
   
 
927
         sge_free_saved_vars(context);
 
928
         FREE(buffer);
 
929
         DRETURN(0);
 
930
      }
 
931
   }
 
932
 
 
933
   sge_free_saved_vars(context);
 
934
   FREE(buffer);
 
935
   DRETURN(1);
 
936
}
 
937
 
 
938
spooling_field *sge_build_CONF_field_list(bool spool_config)
 
939
{
 
940
   /* There are 4 possible CONF_Type fields. */
 
941
   spooling_field *fields = (spooling_field *)malloc(sizeof(spooling_field)*4);
 
942
   int count = 0;
 
943
   
 
944
   if (spool_config) {
 
945
      create_spooling_field(&fields[count++], CONF_name, 28, "conf_name",
 
946
                             NULL, NULL, NULL, NULL);
 
947
      create_spooling_field(&fields[count++], CONF_version, 28, "conf_version",
 
948
                             NULL, NULL, NULL, NULL);
 
949
   }
 
950
   
 
951
   create_spooling_field(&fields[count++], CONF_entries, 28, NULL,
 
952
                          CF_sub_fields, &qconf_sub_param_sfi, NULL, NULL);
 
953
   create_spooling_field(&fields[count++], NoName, 28, NULL, NULL, NULL, NULL,
 
954
                          NULL);
 
955
   
 
956
   return fields;
 
957
}
 
958
 
 
959
spooling_field *sge_build_QU_field_list(bool to_stdout, bool to_file)
 
960
{
 
961
   /* There are 52 possible QU_Type fields. */
 
962
   spooling_field *fields = (spooling_field *)malloc(sizeof(spooling_field)*52);
 
963
   int count = 0;
 
964
   
 
965
   create_spooling_field (&fields[count++], QU_qname, 21, "qname", NULL,
 
966
                          NULL, NULL, NULL);
 
967
   create_spooling_field (&fields[count++], QU_qhostname, 21, "hostname",
 
968
                          NULL, NULL, NULL, NULL);
 
969
   
 
970
   if (to_stdout) {
 
971
      create_spooling_field (&fields[count++], QU_seq_no, 21, "seq_no", NULL,
 
972
                             NULL, NULL, NULL);
 
973
      create_spooling_field (&fields[count++], QU_load_thresholds, 21,
 
974
                             "load_thresholds", CE_sub_fields, NULL, NULL, NULL);
 
975
      create_spooling_field (&fields[count++], QU_suspend_thresholds, 21,
 
976
                             "suspend_thresholds", CE_sub_fields, NULL, NULL, NULL);
 
977
      create_spooling_field (&fields[count++], QU_nsuspend, 21, "nsuspend",
 
978
                             NULL, NULL, NULL, NULL);
 
979
      create_spooling_field (&fields[count++], QU_suspend_interval, 21,
 
980
                             "suspend_interval", NULL, NULL, NULL, NULL);
 
981
      create_spooling_field (&fields[count++], QU_priority, 21, "priority",
 
982
                             NULL, NULL, NULL, NULL);
 
983
      create_spooling_field (&fields[count++], QU_min_cpu_interval, 21,
 
984
                             "min_cpu_interval", NULL, NULL, NULL, NULL);
 
985
      create_spooling_field (&fields[count++], QU_processors, 21, "processors",
 
986
                             NULL, NULL, NULL, NULL);
 
987
      create_spooling_field (&fields[count++], QU_qtype, 21, "qtype", NULL,
 
988
                             NULL, NULL, NULL);
 
989
      create_spooling_field (&fields[count++], QU_ckpt_list, 21, "ckpt_list",
 
990
                             ST_sub_fields, NULL, NULL, NULL);
 
991
      create_spooling_field (&fields[count++], QU_pe_list, 21, "pe_list",
 
992
                             ST_sub_fields, NULL, NULL, NULL);
 
993
      create_spooling_field (&fields[count++], QU_rerun, 21, "rerun", NULL,
 
994
                             NULL, NULL, NULL);
 
995
      create_spooling_field (&fields[count++], QU_job_slots, 21, "slots", NULL,
 
996
                             NULL, NULL, NULL);
 
997
      create_spooling_field (&fields[count++], QU_tmpdir, 21, "tmpdir", NULL,
 
998
                             NULL, NULL, NULL);
 
999
      create_spooling_field (&fields[count++], QU_shell, 21, "shell", NULL,
 
1000
                             NULL, NULL, NULL);
 
1001
      create_spooling_field (&fields[count++], QU_prolog, 21, "prolog", NULL,
 
1002
                             NULL, NULL, NULL);
 
1003
      create_spooling_field (&fields[count++], QU_epilog, 21, "epilog", NULL,
 
1004
                             NULL, NULL, NULL);
 
1005
      create_spooling_field (&fields[count++], QU_shell_start_mode, 21,
 
1006
                             "shell_start_mode", NULL, NULL, NULL, NULL);
 
1007
      create_spooling_field (&fields[count++], QU_starter_method, 21,
 
1008
                             "starter_method", NULL, NULL, NULL, NULL);
 
1009
      create_spooling_field (&fields[count++], QU_suspend_method, 21,
 
1010
                             "suspend_method", NULL, NULL, NULL, NULL);
 
1011
      create_spooling_field (&fields[count++], QU_resume_method, 21,
 
1012
                             "resume_method", NULL, NULL, NULL, NULL);
 
1013
      create_spooling_field (&fields[count++], QU_terminate_method, 21,
 
1014
                             "terminate_method", NULL, NULL, NULL, NULL);
 
1015
      create_spooling_field (&fields[count++], QU_notify, 21, "notify", NULL,
 
1016
                             NULL, NULL, NULL);
 
1017
      create_spooling_field (&fields[count++], QU_owner_list, 21, "owner_list",
 
1018
                             US_sub_fields, NULL, NULL, NULL);
 
1019
      create_spooling_field (&fields[count++], QU_acl, 21, "user_lists",
 
1020
                             US_sub_fields, NULL, NULL, NULL);
 
1021
      create_spooling_field (&fields[count++], QU_xacl, 21, "xuser_lists",
 
1022
                             US_sub_fields, NULL, NULL, NULL);
 
1023
      create_spooling_field (&fields[count++], QU_subordinate_list, 21,
 
1024
                             "subordinate_list", SO_sub_fields, NULL, NULL,
 
1025
                             NULL);
 
1026
      create_spooling_field (&fields[count++], QU_consumable_config_list, 21,
 
1027
                             "complex_values", CE_sub_fields, NULL, NULL, NULL);
 
1028
      
 
1029
      create_spooling_field (&fields[count++], QU_projects, 21, "projects",
 
1030
                             PR_sub_fields, NULL, NULL, NULL);
 
1031
      create_spooling_field (&fields[count++], QU_xprojects, 21, "xprojects",
 
1032
                             PR_sub_fields, NULL, NULL, NULL);
 
1033
      
 
1034
      create_spooling_field (&fields[count++], QU_calendar, 21, "calendar",
 
1035
                             NULL, NULL, NULL, NULL);
 
1036
      create_spooling_field (&fields[count++], QU_initial_state, 21,
 
1037
                             "initial_state", NULL, NULL, NULL, NULL);
 
1038
#if 0
 
1039
      create_spooling_field (&fields[count++], QU_fshare, 21, "fshare", NULL,
 
1040
                             NULL, NULL, NULL);
 
1041
      create_spooling_field (&fields[count++], QU_oticket, 21, "oticket",
 
1042
                             NULL, NULL, NULL, NULL);
 
1043
#endif
 
1044
      create_spooling_field (&fields[count++], QU_s_rt, 21, "s_rt", NULL, NULL,
 
1045
                             NULL, NULL);
 
1046
      create_spooling_field (&fields[count++], QU_h_rt, 21, "h_rt", NULL, NULL,
 
1047
                             NULL, NULL);
 
1048
      create_spooling_field (&fields[count++], QU_s_cpu, 21, "s_cpu", NULL,
 
1049
                             NULL, NULL, NULL);
 
1050
      create_spooling_field (&fields[count++], QU_h_cpu, 21, "h_cpu", NULL,
 
1051
                             NULL, NULL, NULL);
 
1052
      create_spooling_field (&fields[count++], QU_s_fsize, 21, "s_fsize", NULL,
 
1053
                             NULL, NULL, NULL);
 
1054
      create_spooling_field (&fields[count++], QU_h_fsize, 21, "h_fsize", NULL,
 
1055
                             NULL, NULL, NULL);
 
1056
      create_spooling_field (&fields[count++], QU_s_data, 21, "s_data", NULL,
 
1057
                             NULL, NULL, NULL);
 
1058
      create_spooling_field (&fields[count++], QU_h_data, 21, "h_data", NULL,
 
1059
                             NULL, NULL, NULL);
 
1060
      create_spooling_field (&fields[count++], QU_s_stack, 21, "s_stack", NULL,
 
1061
                             NULL, NULL, NULL);
 
1062
      create_spooling_field (&fields[count++], QU_h_stack, 21, "h_stack", NULL,
 
1063
                             NULL, NULL, NULL);
 
1064
      create_spooling_field (&fields[count++], QU_s_core, 21, "s_core", NULL,
 
1065
                             NULL, NULL, NULL);
 
1066
      create_spooling_field (&fields[count++], QU_h_core, 21, "h_core", NULL,
 
1067
                             NULL, NULL, NULL);
 
1068
      create_spooling_field (&fields[count++], QU_s_rss, 21, "s_rss", NULL,
 
1069
                             NULL, NULL, NULL);
 
1070
      create_spooling_field (&fields[count++], QU_h_rss, 21, "h_rss", NULL,
 
1071
                             NULL, NULL, NULL);
 
1072
      create_spooling_field (&fields[count++], QU_s_vmem, 21, "s_vmem", NULL,
 
1073
                             NULL, NULL, NULL);
 
1074
      create_spooling_field (&fields[count++], QU_h_vmem, 21, "h_vmem", NULL,
 
1075
                             NULL, NULL, NULL);
 
1076
   } else if (to_file) {
 
1077
      /*
 
1078
       * Spool only non-CQ attributes
 
1079
       */
 
1080
      create_spooling_field (&fields[count++], QU_state, 21, "state", NULL,
 
1081
                             NULL, NULL, NULL);
 
1082
      create_spooling_field (&fields[count++], QU_pending_signal, 21,
 
1083
                             "pending_signal", NULL, NULL, NULL, NULL);
 
1084
      create_spooling_field (&fields[count++], QU_pending_signal_delivery_time,
 
1085
                             21, "pending_signal_del", NULL, NULL,
 
1086
                             NULL, NULL);
 
1087
      create_spooling_field (&fields[count++], QU_version, 21, "version", NULL,
 
1088
                             NULL, NULL, NULL);
 
1089
      /* SG: not supported */
 
1090
#if 0      
 
1091
      create_spooling_field (&fields[count++], QU_error_messages, 21,
 
1092
                             "error_messages", NULL, NULL, NULL, NULL);
 
1093
#endif      
 
1094
   }
 
1095
   create_spooling_field (&fields[count++], NoName, 21, NULL, NULL, NULL, NULL,
 
1096
                          NULL);
 
1097
   
 
1098
   return fields;
 
1099
}
 
1100
 
 
1101
static int read_CQ_ulng_attr_list(lListElem *ep, int nm, const char *buffer, lList **alp)
 
1102
{
 
1103
   lList *lp = NULL;
 
1104
   
 
1105
   if (!ulng_attr_list_parse_from_string(&lp, alp, buffer,
 
1106
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1107
      return 0;
 
1108
   }
 
1109
   
 
1110
   if (lp != NULL) {
 
1111
      lSetList(ep, nm, lp);
 
1112
      return 1;
 
1113
   }
 
1114
   
 
1115
   return 0;
 
1116
}
 
1117
 
 
1118
static int write_CQ_ulng_attr_list(const lListElem *ep, int nm,
 
1119
                                   dstring *buffer, lList **alp)
 
1120
{
 
1121
   ulng_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1122
   
 
1123
   return 1;
 
1124
}
 
1125
 
 
1126
static int read_CQ_celist_attr_list(lListElem *ep, int nm, const char *buffer,
 
1127
                                     lList **alp)
 
1128
{
 
1129
   lList *lp = NULL;
 
1130
   
 
1131
   if (!celist_attr_list_parse_from_string(&lp, alp, buffer,
 
1132
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1133
      return 0;
 
1134
   }
 
1135
   
 
1136
   if (lp != NULL) {
 
1137
      lSetList(ep, nm, lp);
 
1138
      return 1;
 
1139
   }
 
1140
   
 
1141
   return 0;
 
1142
}
 
1143
 
 
1144
static int write_CQ_celist_attr_list(const lListElem *ep, int nm,
 
1145
                                   dstring *buffer, lList **alp)
 
1146
{
 
1147
   celist_attr_list_append_to_dstring(lGetList(ep, nm), buffer);
 
1148
   
 
1149
   return 1;
 
1150
}
 
1151
 
 
1152
static int read_CQ_inter_attr_list(lListElem *ep, int nm, const char *buffer,
 
1153
                                    lList **alp)
 
1154
{
 
1155
   lList *lp = NULL;
 
1156
   
 
1157
   if (!inter_attr_list_parse_from_string(&lp, alp, buffer,
 
1158
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1159
      return 0;
 
1160
   }
 
1161
   
 
1162
   if (lp != NULL) {
 
1163
      lSetList(ep, nm, lp);
 
1164
      return 1;
 
1165
   }
 
1166
   
 
1167
   return 0;
 
1168
}
 
1169
 
 
1170
static int write_CQ_inter_attr_list(const lListElem *ep, int nm,
 
1171
                                   dstring *buffer, lList **alp)
 
1172
{
 
1173
   inter_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1174
   
 
1175
   return 1;
 
1176
}
 
1177
 
 
1178
static int read_CQ_str_attr_list(lListElem *ep, int nm, const char *buffer,
 
1179
                                  lList **alp)
 
1180
{
 
1181
   lList *lp = NULL;
 
1182
   
 
1183
   if (!str_attr_list_parse_from_string(&lp, alp, buffer,
 
1184
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1185
      return 0;
 
1186
   }
 
1187
   
 
1188
   if (lp != NULL) {
 
1189
      lSetList(ep, nm, lp);
 
1190
      return 1;
 
1191
   }
 
1192
   
 
1193
   return 0;
 
1194
}
 
1195
 
 
1196
static int write_CQ_str_attr_list(const lListElem *ep, int nm,
 
1197
                                   dstring *buffer, lList **alp)
 
1198
{
 
1199
   str_attr_list_append_to_dstring(lGetList(ep, nm), buffer);
 
1200
   
 
1201
   return 1;
 
1202
}
 
1203
 
 
1204
static int read_CQ_qtlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
1205
                                     lList **alp)
 
1206
{
 
1207
   lList *lp = NULL;
 
1208
   
 
1209
   if (!qtlist_attr_list_parse_from_string(&lp, alp, buffer,
 
1210
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1211
      return 0;
 
1212
   }
 
1213
   
 
1214
   if (lp != NULL) {
 
1215
      lSetList(ep, nm, lp);
 
1216
      return 1;
 
1217
   }
 
1218
   
 
1219
   return 0;
 
1220
}
 
1221
 
 
1222
static int write_CQ_qtlist_attr_list(const lListElem *ep, int nm,
 
1223
                                   dstring *buffer, lList **alp)
 
1224
{
 
1225
   qtlist_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1226
   
 
1227
   return 1;
 
1228
}
 
1229
 
 
1230
static int read_CQ_strlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
1231
                                      lList **alp)
 
1232
{
 
1233
   lList *lp = NULL;
 
1234
   
 
1235
   if (!strlist_attr_list_parse_from_string(&lp, alp, buffer,
 
1236
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1237
      return 0;
 
1238
   }
 
1239
   
 
1240
   if (lp != NULL) {
 
1241
      lSetList(ep, nm, lp);
 
1242
      return 1;
 
1243
   }
 
1244
   
 
1245
   return 0;
 
1246
}
 
1247
 
 
1248
static int write_CQ_strlist_attr_list(const lListElem *ep, int nm,
 
1249
                                   dstring *buffer, lList **alp)
 
1250
{
 
1251
   strlist_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1252
   
 
1253
   return 1;
 
1254
}
 
1255
 
 
1256
static int read_CQ_bool_attr_list(lListElem *ep, int nm, const char *buffer,
 
1257
                                   lList **alp)
 
1258
{
 
1259
   lList *lp = NULL;
 
1260
   
 
1261
   if (!bool_attr_list_parse_from_string(&lp, alp, buffer,
 
1262
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1263
      return 0;
 
1264
   }
 
1265
   
 
1266
   if (lp != NULL) {
 
1267
      lSetList(ep, nm, lp);
 
1268
      return 1;
 
1269
   }
 
1270
   
 
1271
   return 0;
 
1272
}
 
1273
 
 
1274
static int write_CQ_bool_attr_list(const lListElem *ep, int nm,
 
1275
                                   dstring *buffer, lList **alp)
 
1276
{
 
1277
   bool_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1278
   
 
1279
   return 1;
 
1280
}
 
1281
 
 
1282
static int read_CQ_usrlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
1283
                                      lList **alp)
 
1284
{
 
1285
   lList *lp = NULL;
 
1286
   
 
1287
   if (!usrlist_attr_list_parse_from_string(&lp, alp, buffer,
 
1288
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1289
      return 0;
 
1290
   }
 
1291
   
 
1292
   if (lp != NULL) {
 
1293
      lSetList(ep, nm, lp);
 
1294
      return 1;
 
1295
   }
 
1296
   
 
1297
   return 0;
 
1298
}
 
1299
 
 
1300
static int write_CQ_usrlist_attr_list(const lListElem *ep, int nm,
 
1301
                                   dstring *buffer, lList **alp)
 
1302
{
 
1303
   usrlist_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1304
   
 
1305
   return 1;
 
1306
}
 
1307
 
 
1308
static int read_CQ_solist_attr_list(lListElem *ep, int nm, const char *buffer,
 
1309
                                     lList **alp)
 
1310
{
 
1311
   lList *lp = NULL;
 
1312
   
 
1313
   if (!solist_attr_list_parse_from_string(&lp, alp, buffer,
 
1314
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1315
      return 0;
 
1316
   }
 
1317
   
 
1318
   if (lp != NULL) {
 
1319
      lSetList(ep, nm, lp);
 
1320
      return 1;
 
1321
   }
 
1322
   
 
1323
   return 0;
 
1324
}
 
1325
 
 
1326
static int write_CQ_solist_attr_list(const lListElem *ep, int nm,
 
1327
                                   dstring *buffer, lList **alp)
 
1328
{
 
1329
   solist_attr_list_append_to_dstring(lGetList (ep, nm), buffer);
 
1330
   
 
1331
   return 1;
 
1332
}
 
1333
 
 
1334
static int read_CQ_prjlist_attr_list(lListElem *ep, int nm, const char *buffer,
 
1335
                                      lList **alp)
 
1336
{
 
1337
   lList *lp = NULL;
 
1338
   
 
1339
   if (!prjlist_attr_list_parse_from_string(&lp, alp, buffer,
 
1340
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1341
      return 0;
 
1342
   }
 
1343
   
 
1344
   if (lp != NULL) {
 
1345
      lSetList(ep, nm, lp);
 
1346
      return 1;
 
1347
   }
 
1348
   
 
1349
   return 0;
 
1350
}
 
1351
 
 
1352
static int write_CQ_prjlist_attr_list(const lListElem *ep, int nm,
 
1353
                                   dstring *buffer, lList **alp)
 
1354
{
 
1355
   prjlist_attr_list_append_to_dstring(lGetList(ep, nm), buffer);
 
1356
   
 
1357
   return 1;
 
1358
}
 
1359
 
 
1360
static int read_CQ_time_attr_list(lListElem *ep, int nm, const char *buffer,
 
1361
                                   lList **alp)
 
1362
{
 
1363
   lList *lp = NULL;
 
1364
   
 
1365
   if (!time_attr_list_parse_from_string(&lp, alp, buffer,
 
1366
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1367
      return 0;
 
1368
   }
 
1369
   
 
1370
   if (lp != NULL) {
 
1371
      lSetList(ep, nm, lp);
 
1372
      return 1;
 
1373
   }
 
1374
   
 
1375
   return 0;
 
1376
}
 
1377
 
 
1378
static int write_CQ_time_attr_list(const lListElem *ep, int nm,
 
1379
                                   dstring *buffer, lList **alp)
 
1380
{
 
1381
   time_attr_list_append_to_dstring(lGetList(ep, nm), buffer);
 
1382
   
 
1383
   return 1;
 
1384
}
 
1385
 
 
1386
static int read_CQ_mem_attr_list(lListElem *ep, int nm, const char *buffer,
 
1387
                                  lList **alp)
 
1388
{
 
1389
   lList *lp = NULL;
 
1390
   
 
1391
   if (!mem_attr_list_parse_from_string(&lp, alp, buffer,
 
1392
                                          HOSTATTR_ALLOW_AMBIGUITY)) {
 
1393
      return 0;
 
1394
   }
 
1395
   
 
1396
   if (lp != NULL) {
 
1397
      lSetList(ep, nm, lp);
 
1398
      return 1;
 
1399
   }
 
1400
   
 
1401
   return 0;
 
1402
}
 
1403
 
 
1404
static int write_CQ_mem_attr_list(const lListElem *ep, int nm,
 
1405
                                   dstring *buffer, lList **alp)
 
1406
{
 
1407
   mem_attr_list_append_to_dstring(lGetList(ep, nm), buffer);
 
1408
   
 
1409
   return 1;
 
1410
}
 
1411
 
 
1412
static int read_CQ_hostlist(lListElem *ep, int nm, const char *buffer,
 
1413
                             lList **alp)
 
1414
{
 
1415
   lList *lp = NULL;
 
1416
   char delims[] = "\t \v\r,"; 
 
1417
 
 
1418
   lString2List(buffer, &lp, HR_Type, HR_name, delims); 
 
1419
 
 
1420
   if (lp != NULL) {
 
1421
      if (strcasecmp(NONE_STR, lGetHost(lFirst(lp), HR_name)) != 0) {
 
1422
         lSetList(ep, CQ_hostlist, lp);
 
1423
      } else {
 
1424
         lFreeList(&lp);
 
1425
      }
 
1426
   }
 
1427
 
 
1428
   return 1;
 
1429
}
 
1430
 
 
1431
static int write_CQ_hostlist(const lListElem *ep, int nm,
 
1432
                             dstring *buffer, lList **alp)
 
1433
{
 
1434
   lList *lp = lGetList(ep, nm);
 
1435
   
 
1436
   if (lp != NULL) {
 
1437
      href_list_append_to_dstring(lp, buffer);
 
1438
   } else {
 
1439
      sge_dstring_append(buffer, NONE_STR);
 
1440
   }
 
1441
   
 
1442
   return 1;
 
1443
}
 
1444
 
 
1445
static int write_CE_stringval(const lListElem *ep, int nm, dstring *buffer,
 
1446
                       lList **alp)
 
1447
{
 
1448
   const char *s;
 
1449
 
 
1450
   if ((s=lGetString(ep, CE_stringval)) != NULL) {
 
1451
      sge_dstring_append(buffer, s);
 
1452
   } else {
 
1453
      sge_dstring_sprintf_append(buffer, "%f", lGetDouble(ep, CE_doubleval));
 
1454
   }
 
1455
   
 
1456
   return 1;
 
1457
}
 
1458
 
 
1459
/****** sge_flatfile_obj/read_RQR_obj() ****************************************
 
1460
*  NAME
 
1461
*     read_RQR_obj() -- parse a RQR object from string
 
1462
*
 
1463
*  SYNOPSIS
 
1464
*     static int read_RQR_obj(lListElem *ep, int nm, const char *buffer, lList 
 
1465
*     **alp) 
 
1466
*
 
1467
*  FUNCTION
 
1468
*     Reads in a RQR Element from string
 
1469
*
 
1470
*  INPUTS
 
1471
*     lListElem *ep      - Store for parsed Elem
 
1472
*     int nm             - nm to be parsed 
 
1473
*     const char *buffer - String of the elem to be parsed
 
1474
*     lList **alp        - Answer list
 
1475
*
 
1476
*  RESULT
 
1477
*     static int - 1 on success
 
1478
*                  0 on error
 
1479
*
 
1480
*  NOTES
 
1481
*     MT-NOTE: read_RQR_obj() is MT safe 
 
1482
*
 
1483
*******************************************************************************/
 
1484
static int read_RQR_obj(lListElem *ep, int nm, const char *buffer,
 
1485
                             lList **alp) {
 
1486
   lListElem *filter = NULL;
 
1487
   int ret = 1;
 
1488
 
 
1489
   DENTER(TOP_LAYER, "read_RQR_obj");
 
1490
 
 
1491
   if ((ret = rqs_parse_filter_from_string(&filter, buffer, alp)) == 1) {
 
1492
      lSetObject(ep, nm, filter);
 
1493
   } 
 
1494
 
 
1495
   DRETURN(ret);
 
1496
}
 
1497
 
 
1498
/****** sge_flatfile_obj/write_RQR_obj() ***************************************
 
1499
*  NAME
 
1500
*     write_RQR_obj() -- converts a element to string
 
1501
*
 
1502
*  SYNOPSIS
 
1503
*     static int write_RQR_obj(const lListElem *ep, int nm, dstring *buffer, lList 
 
1504
*     **alp) 
 
1505
*
 
1506
*  FUNCTION
 
1507
*     Prints out a RQR Element to a string
 
1508
*
 
1509
*  INPUTS
 
1510
*     const lListElem *ep - Elem to be converted
 
1511
*     int nm              - nm of Elem
 
1512
*     dstring *buffer     - Element as string
 
1513
*     lList **alp         - Answer List
 
1514
*
 
1515
*  RESULT
 
1516
*     static int - 1 on success
 
1517
*                  0 on error
 
1518
*
 
1519
*  NOTES
 
1520
*     MT-NOTE: write_RQR_obj() is MT safe 
 
1521
*
 
1522
*******************************************************************************/
 
1523
static int write_RQR_obj(const lListElem *ep, int nm, dstring *buffer,
 
1524
                       lList **alp) {
 
1525
   return rqs_append_filter_to_dstring(lGetObject(ep, nm), buffer, alp);
 
1526
}