Skip to content
Snippets Groups Projects
Commit 62253984 authored by Steven Murray's avatar Steven Murray
Browse files

Moved rmc_log_req() into its own object file

parent 94da6b03
Branches
Tags
No related merge requests found
/*
* Copyright (C) 2001 by CERN/IT/PDP/DM
* All rights reserved
*/
#ifndef _RMC_LOGREQ_H
#define _RMC_LOGREQ_H 1
void rmc_logreq(const char *const func, char *const logbuf);
#endif
......@@ -11,7 +11,7 @@ include $(CASTOR_ROOT)/tape/Makefile
RMCD_DEPLIBS = DepSharedLibraryTargetName(tape,castortape)
RMCD_LIBS = $(RMCD_DEPLIBS) BuildRPathcastortape
RMCD_OBJS = rmc_serv.o rmc_procreq.o rmc_logit.o rmc_sendrep.o rmc_smcsubr.o rmc_send_scsi_cmd.o
RMCD_OBJS = rmc_serv.o rmc_procreq.o rmc_logit.o rmc_logreq.o rmc_sendrep.o rmc_smcsubr.o rmc_send_scsi_cmd.o
TapeProgramTarget(rmcd,$(RMCD_OBJS),$(RMCD_DEPLIBS),$(RMCD_LIBS),755)
ADMMANPAGE(rmcd)
TapeMakeDir($(LOGPATH),0755)
......
/*
* Copyright (C) 2001-2002 by CERN/IT/PDP/DM
* All rights reserved
*/
#include "h/rmc_constants.h"
#include "h/rmc_logit.h"
#include "h/rmc_logreq.h"
#include "h/tplogger_api.h"
#include <string.h>
/* rmc_logreq - log a request */
/* Split the message into lines so they don't exceed LOGBUFSZ-1 characters
* A backslash is appended to a line to be continued
* A continuation line is prefixed by '+ '
*/
void rmc_logreq(const char *const func, char *const logbuf) {
int n1, n2;
char *p;
char savechrs1[2];
char savechrs2[2];
n1 = RMC_LOGBUFSZ - strlen (func) - 36;
n2 = strlen (logbuf);
p = logbuf;
while (n2 > n1) {
savechrs1[0] = *(p + n1);
savechrs1[1] = *(p + n1 + 1);
*(p + n1) = '\\';
*(p + n1 + 1) = '\0';
rmc_logit (func, RMC98, p);
tl_rmcdaemon.tl_log( &tl_rmcdaemon, 98, 2,
"func" , TL_MSG_PARAM_STR, "rmc_logreq",
"Request", TL_MSG_PARAM_STR, p );
if (p != logbuf) {
*p = savechrs2[0];
*(p + 1) = savechrs2[1];
}
p += n1 - 2;
savechrs2[0] = *p;
savechrs2[1] = *(p + 1);
*p = '+';
*(p + 1) = ' ';
*(p + 2) = savechrs1[0];
*(p + 3) = savechrs1[1];
n2 -= n1;
}
rmc_logit (func, RMC98, p);
tl_rmcdaemon.tl_log( &tl_rmcdaemon, 98, 2,
"func" , TL_MSG_PARAM_STR, "rmc_logreq",
"Request", TL_MSG_PARAM_STR, p );
if (p != logbuf) {
*p = savechrs2[0];
*(p + 1) = savechrs2[1];
}
}
......@@ -17,6 +17,7 @@
#include "h/serrno.h"
#include "h/rmc_constants.h"
#include "h/rmc_logit.h"
#include "h/rmc_logreq.h"
#include "h/rmc_smcsubr.h"
#include "h/rmc_smcsubr2.h"
#include "h/rmc_sendrep.h"
......@@ -27,54 +28,6 @@
extern struct extended_robot_info extended_robot_info;
extern char localhost[CA_MAXHOSTNAMELEN+1];
/* rmc_logreq - log a request */
/* Split the message into lines so they don't exceed LOGBUFSZ-1 characters
* A backslash is appended to a line to be continued
* A continuation line is prefixed by '+ '
*/
static void rmc_logreq(const char *const func, char *const logbuf)
{
int n1, n2;
char *p;
char savechrs1[2];
char savechrs2[2];
n1 = RMC_LOGBUFSZ - strlen (func) - 36;
n2 = strlen (logbuf);
p = logbuf;
while (n2 > n1) {
savechrs1[0] = *(p + n1);
savechrs1[1] = *(p + n1 + 1);
*(p + n1) = '\\';
*(p + n1 + 1) = '\0';
rmc_logit (func, RMC98, p);
tl_rmcdaemon.tl_log( &tl_rmcdaemon, 98, 2,
"func" , TL_MSG_PARAM_STR, "rmc_logreq",
"Request", TL_MSG_PARAM_STR, p );
if (p != logbuf) {
*p = savechrs2[0];
*(p + 1) = savechrs2[1];
}
p += n1 - 2;
savechrs2[0] = *p;
savechrs2[1] = *(p + 1);
*p = '+';
*(p + 1) = ' ';
*(p + 2) = savechrs1[0];
*(p + 3) = savechrs1[1];
n2 -= n1;
}
rmc_logit (func, RMC98, p);
tl_rmcdaemon.tl_log( &tl_rmcdaemon, 98, 2,
"func" , TL_MSG_PARAM_STR, "rmc_logreq",
"Request", TL_MSG_PARAM_STR, p );
if (p != logbuf) {
*p = savechrs2[0];
*(p + 1) = savechrs2[1];
}
}
static int marshall_ELEMENT (
char **const sbpp,
const struct smc_element_info *const element_info)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment