Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
956943a7
Commit
956943a7
authored
Mar 04, 2005
by
Leigh B. Stoller
Browse files
Add topomap function to spit back the topomap.gz from /usr/tesbed/expwork
To be used as a backup for NFS.
parent
1f6d5468
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/tmcd.c
View file @
956943a7
...
...
@@ -234,6 +234,7 @@ COMMAND_PROTOTYPE(dolocalize);
COMMAND_PROTOTYPE
(
dobooterrno
);
COMMAND_PROTOTYPE
(
dobootlog
);
COMMAND_PROTOTYPE
(
dobattery
);
COMMAND_PROTOTYPE
(
dotopomap
);
/*
* The fullconfig slot determines what routines get called when pushing
...
...
@@ -314,6 +315,7 @@ struct command {
{
"booterrno"
,
FULLCONFIG_NONE
,
0
,
dobooterrno
},
{
"bootlog"
,
FULLCONFIG_NONE
,
0
,
dobootlog
},
{
"battery"
,
FULLCONFIG_NONE
,
F_REMUDP
|
F_MINLOG
,
dobattery
},
{
"topomap"
,
FULLCONFIG_NONE
,
F_MINLOG
|
F_ALLOCATED
,
dotopomap
},
};
static
int
numcommands
=
sizeof
(
command_array
)
/
sizeof
(
struct
command
);
...
...
@@ -5785,3 +5787,40 @@ COMMAND_PROTOTYPE(dobattery)
return
0
;
}
/*
* Spit back the topomap. This is a backup for when NFS fails.
* We send back the gzipped version.
*/
COMMAND_PROTOTYPE
(
dotopomap
)
{
FILE
*
fp
;
char
buf
[
MYBUFSIZE
];
int
cc
;
/*
* Open up the file on boss and spit it back.
*/
sprintf
(
buf
,
"%s/expwork/%s/%s/topomap.gz"
,
TBROOT
,
reqp
->
pid
,
reqp
->
eid
);
if
((
fp
=
fopen
(
buf
,
"r"
))
==
NULL
)
{
errorc
(
"DOTOPOMAP: Could not open topomap for %s:"
,
reqp
->
nodeid
);
return
1
;
}
while
(
1
)
{
cc
=
fread
(
buf
,
sizeof
(
char
),
sizeof
(
buf
),
fp
);
if
(
cc
==
0
)
{
if
(
ferror
(
fp
))
{
fclose
(
fp
);
return
1
;
}
break
;
}
client_writeback
(
sock
,
buf
,
cc
,
tcp
);
}
fclose
(
fp
);
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment