Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
7531c3c3
Commit
7531c3c3
authored
17 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
better handle NULL pointers to ARCH, OS, or node features
parent
7aed3382
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/sched/wiki2/get_nodes.c
+20
-14
20 additions, 14 deletions
src/plugins/sched/wiki2/get_nodes.c
with
20 additions
and
14 deletions
src/plugins/sched/wiki2/get_nodes.c
+
20
−
14
View file @
7531c3c3
...
@@ -46,6 +46,7 @@ static char * _dump_node(struct node_record *node_ptr, hostlist_t hl,
...
@@ -46,6 +46,7 @@ static char * _dump_node(struct node_record *node_ptr, hostlist_t hl,
static
char
*
_get_node_state
(
struct
node_record
*
node_ptr
);
static
char
*
_get_node_state
(
struct
node_record
*
node_ptr
);
static
int
_same_info
(
struct
node_record
*
node1_ptr
,
static
int
_same_info
(
struct
node_record
*
node1_ptr
,
struct
node_record
*
node2_ptr
,
int
state_info
);
struct
node_record
*
node2_ptr
,
int
state_info
);
static
int
_str_cmp
(
char
*
s1
,
char
*
s2
);
#define SLURM_INFO_ALL 0
#define SLURM_INFO_ALL 0
#define SLURM_INFO_VOLITILE 1
#define SLURM_INFO_VOLITILE 1
...
@@ -78,7 +79,7 @@ static int _same_info(struct node_record *node1_ptr,
...
@@ -78,7 +79,7 @@ static int _same_info(struct node_record *node1_ptr,
extern
int
get_nodes
(
char
*
cmd_ptr
,
int
*
err_code
,
char
**
err_msg
)
extern
int
get_nodes
(
char
*
cmd_ptr
,
int
*
err_code
,
char
**
err_msg
)
{
{
char
*
arg_ptr
=
NULL
,
*
tmp_char
=
NULL
,
*
tmp_buf
=
NULL
,
*
buf
=
NULL
;
char
*
arg_ptr
=
NULL
,
*
tmp_char
=
NULL
,
*
tmp_buf
=
NULL
,
*
buf
=
NULL
;
time_t
update_time
;
time_t
update_time
;
static
int
_str_cmp
(
char
*
s1
,
char
*
s2
);
/* Locks: read node, read partition */
/* Locks: read node, read partition */
slurmctld_lock_t
node_read_lock
=
{
slurmctld_lock_t
node_read_lock
=
{
NO_LOCK
,
NO_LOCK
,
READ_LOCK
,
READ_LOCK
};
NO_LOCK
,
NO_LOCK
,
READ_LOCK
,
READ_LOCK
};
...
@@ -221,11 +222,7 @@ static int _same_info(struct node_record *node1_ptr,
...
@@ -221,11 +222,7 @@ static int _same_info(struct node_record *node1_ptr,
if
(
node1_ptr
->
node_state
!=
node2_ptr
->
node_state
)
if
(
node1_ptr
->
node_state
!=
node2_ptr
->
node_state
)
return
1
;
return
1
;
if
(((
node1_ptr
->
reason
==
NULL
)
&&
node2_ptr
->
reason
)
||
if
(
_str_cmp
(
node1_ptr
->
reason
,
node2_ptr
->
reason
))
((
node2_ptr
->
reason
==
NULL
)
&&
node1_ptr
->
reason
))
return
2
;
if
(
node1_ptr
->
reason
&&
node2_ptr
->
reason
&&
strcmp
(
node1_ptr
->
reason
,
node2_ptr
->
reason
))
return
2
;
return
2
;
if
(
state_info
==
SLURM_INFO_STATE
)
if
(
state_info
==
SLURM_INFO_STATE
)
return
0
;
return
0
;
...
@@ -245,11 +242,9 @@ static int _same_info(struct node_record *node1_ptr,
...
@@ -245,11 +242,9 @@ static int _same_info(struct node_record *node1_ptr,
if
(
node1_ptr
->
part_pptr
[
i
]
!=
node2_ptr
->
part_pptr
[
i
])
if
(
node1_ptr
->
part_pptr
[
i
]
!=
node2_ptr
->
part_pptr
[
i
])
return
6
;
return
6
;
}
}
if
(
node1_ptr
->
arch
&&
node2_ptr
->
arch
&&
if
(
_str_cmp
(
node1_ptr
->
arch
,
node2_ptr
->
arch
))
strcmp
(
node1_ptr
->
arch
,
node2_ptr
->
arch
))
return
7
;
return
7
;
if
(
node1_ptr
->
os
&&
node2_ptr
->
os
&&
if
(
_str_cmp
(
node1_ptr
->
os
,
node2_ptr
->
os
))
strcmp
(
node1_ptr
->
os
,
node2_ptr
->
os
))
return
8
;
return
8
;
if
(
state_info
==
SLURM_INFO_VOLITILE
)
if
(
state_info
==
SLURM_INFO_VOLITILE
)
return
0
;
return
0
;
...
@@ -269,10 +264,8 @@ static int _same_info(struct node_record *node1_ptr,
...
@@ -269,10 +264,8 @@ static int _same_info(struct node_record *node1_ptr,
(
node1_ptr
->
cpus
!=
node2_ptr
->
cpus
))
(
node1_ptr
->
cpus
!=
node2_ptr
->
cpus
))
return
10
;
return
10
;
}
}
if
((
node1_ptr
->
config_ptr
->
feature
!=
if
(
_str_cmp
(
node1_ptr
->
config_ptr
->
feature
,
node2_ptr
->
config_ptr
->
feature
)
||
node2_ptr
->
config_ptr
->
feature
))
strcmp
(
node1_ptr
->
config_ptr
->
feature
,
node2_ptr
->
config_ptr
->
feature
))
return
11
;
return
11
;
return
0
;
return
0
;
}
}
...
@@ -395,3 +388,16 @@ static char * _get_node_state(struct node_record *node_ptr)
...
@@ -395,3 +388,16 @@ static char * _get_node_state(struct node_record *node_ptr)
return
"Unknown"
;
return
"Unknown"
;
}
}
/* Like strcmp(), but can handle NULL pointers */
static
int
_str_cmp
(
char
*
s1
,
char
*
s2
)
{
if
(
s1
&&
s2
)
return
strcmp
(
s1
,
s2
);
if
((
s1
==
NULL
)
&&
(
s2
==
NULL
))
return
0
;
/* One pointer is valid and the other is NULL */
return
1
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment