From 1c5c4c4c5b59cb82411673c991b0c71ab02bb39e Mon Sep 17 00:00:00 2001 From: Steven Murray <Steven.Murray@cern.ch> Date: Tue, 14 Oct 2014 17:24:14 +0200 Subject: [PATCH] Removed the now redundant work for the rmcd "super-daemon" There will be separate rmcd and acsd daemons, therefore removing the need for an rmcd "super-daemon" that does both SCSI and ACS. --- mediachanger/castorrmc/h/rmc_api.h | 2 - mediachanger/castorrmc/h/rmc_constants.h | 18 +-- mediachanger/castorrmc/h/rmc_find_char.h | 41 ----- .../castorrmc/h/rmc_get_acs_drive_id.h | 58 ------- .../castorrmc/h/rmc_get_loader_type.h | 51 ------ .../castorrmc/h/rmc_get_rmc_host_of_drive.h | 48 ------ mediachanger/castorrmc/h/rmc_procreq.h | 13 +- mediachanger/castorrmc/rmc/rmc_dismount.c | 2 +- mediachanger/castorrmc/rmc/rmc_export.c | 2 +- .../castorrmc/rmc/rmc_find_cartridge.c | 2 +- mediachanger/castorrmc/rmc/rmc_find_char.c | 40 ----- .../castorrmc/rmc/rmc_get_acs_drive_id.c | 123 --------------- mediachanger/castorrmc/rmc/rmc_get_geometry.c | 2 +- .../castorrmc/rmc/rmc_get_loader_type.c | 38 ----- .../castorrmc/rmc/rmc_get_rmc_host_of_drive.c | 58 ------- mediachanger/castorrmc/rmc/rmc_import.c | 2 +- mediachanger/castorrmc/rmc/rmc_mnt.c | 90 ++--------- mediachanger/castorrmc/rmc/rmc_mnt.man | 59 ++----- mediachanger/castorrmc/rmc/rmc_mount.c | 2 +- mediachanger/castorrmc/rmc/rmc_procreq.c | 27 +--- .../castorrmc/rmc/rmc_read_elem_status.c | 2 +- mediachanger/castorrmc/rmc/rmc_serv.c | 36 ++--- mediachanger/castorrmc/rmc/rmc_unmnt.c | 145 ------------------ mediachanger/castorrmc/rmc/rmc_unmnt.man | 78 ---------- mediachanger/castorrmc/rmc/rmcd.man | 125 +++++++-------- 25 files changed, 137 insertions(+), 927 deletions(-) delete mode 100644 mediachanger/castorrmc/h/rmc_find_char.h delete mode 100644 mediachanger/castorrmc/h/rmc_get_acs_drive_id.h delete mode 100644 mediachanger/castorrmc/h/rmc_get_loader_type.h delete mode 100644 mediachanger/castorrmc/h/rmc_get_rmc_host_of_drive.h delete mode 100644 mediachanger/castorrmc/rmc/rmc_find_char.c delete mode 100644 mediachanger/castorrmc/rmc/rmc_get_acs_drive_id.c delete mode 100644 mediachanger/castorrmc/rmc/rmc_get_loader_type.c delete mode 100644 mediachanger/castorrmc/rmc/rmc_get_rmc_host_of_drive.c delete mode 100644 mediachanger/castorrmc/rmc/rmc_unmnt.c delete mode 100644 mediachanger/castorrmc/rmc/rmc_unmnt.man diff --git a/mediachanger/castorrmc/h/rmc_api.h b/mediachanger/castorrmc/h/rmc_api.h index 6f48388fef..ef99db8e06 100644 --- a/mediachanger/castorrmc/h/rmc_api.h +++ b/mediachanger/castorrmc/h/rmc_api.h @@ -27,6 +27,4 @@ EXTERN_C int rmc_mount(const char *const server, const char *const vid, const in EXTERN_C int rmc_read_elem_status(const char *const server, const int type, const int startaddr, const int nbelem, struct smc_element_info *const element_info); EXTERN_C void rmc_seterrbuf(const char *const buffer, const int buflen); EXTERN_C int send2rmc(const char *const host, const char *const reqp, const int reql, char *const user_repbuf, const int user_repbuf_len); -EXTERN_C int rmc_mnt(const char *const vid, const char *const drive); -EXTERN_C int rmc_unmnt(const char *const vid, const char *const drive); diff --git a/mediachanger/castorrmc/h/rmc_constants.h b/mediachanger/castorrmc/h/rmc_constants.h index fbfd5d81f6..fbe2c1e0db 100644 --- a/mediachanger/castorrmc/h/rmc_constants.h +++ b/mediachanger/castorrmc/h/rmc_constants.h @@ -32,15 +32,15 @@ /* Request types */ -#define RMC_SCSI_GETGEOM 1 /* Get robot geometry */ -#define RMC_SCSI_FINDCART 2 /* Find cartridge(s) */ -#define RMC_SCSI_READELEM 3 /* Read element status */ -#define RMC_SCSI_MOUNT 4 /* Mount request */ -#define RMC_SCSI_UNMOUNT 5 /* Unmount request */ -#define RMC_SCSI_EXPORT 6 /* Export tape request */ -#define RMC_SCSI_IMPORT 7 /* Import tape request */ -#define RMC_ACS_MOUNT 8 /* ACS mount request */ -#define RMC_ACS_UNMOUNT 9 /* ACS unmount request */ +#define RMC_GETGEOM 1 /* Get robot geometry */ +#define RMC_FINDCART 2 /* Find cartridge(s) */ +#define RMC_READELEM 3 /* Read element status */ +#define RMC_MOUNT 4 /* Mount request */ +#define RMC_UNMOUNT 5 /* Unmount request */ +#define RMC_EXPORT 6 /* Export tape request */ +#define RMC_IMPORT 7 /* Import tape request */ +#define RMC_GENERICMOUNT 8 /* Generic (SCSI or ACS) mount request */ +#define RMC_GENERICUNMOUNT 9 /* Generic (SCSI or ACS) mount request */ /* SCSI media changer server reply types */ diff --git a/mediachanger/castorrmc/h/rmc_find_char.h b/mediachanger/castorrmc/h/rmc_find_char.h deleted file mode 100644 index 06b6c35643..0000000000 --- a/mediachanger/castorrmc/h/rmc_find_char.h +++ /dev/null @@ -1,41 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -/****************************************************************************** - * Please note that this file is part of the internal API of the rmc daemon - * and its client software and should therefore not be distributed to end users - *****************************************************************************/ - -#pragma once - -/** - * Returns the index of the specified character within the specified string. - * The search for the character is performed from left to right and stops at the - * first coccurence of the character. - * - * @param str The string to be searched. - * @param c The character to be seacrhed for. - * @return The index of the character if it was found else -1 if not. - */ -int rmc_find_char(const char *const str, const char c); - diff --git a/mediachanger/castorrmc/h/rmc_get_acs_drive_id.h b/mediachanger/castorrmc/h/rmc_get_acs_drive_id.h deleted file mode 100644 index 1eec268f7e..0000000000 --- a/mediachanger/castorrmc/h/rmc_get_acs_drive_id.h +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -/****************************************************************************** - * Please note that this file is part of the internal API of the rmc daemon - * and its client software and should therefore not be distributed to end users - *****************************************************************************/ - -#pragma once - -/** - * Structure representing the identifier of a drive withn an ACS compatible - * tape library. - */ -struct rmc_acs_drive_id { - int acs; - int lsm; - int panel; - int transport; -}; - -/** - * Returns the drive id of the specified drive string of the form: - * - * acs@rmc_host,acs,lsm,panel,transport - * - * There are three RMC loader types, namely acs, manual and smc. The drive - * string is expected to be in one of the following forms respectively: - * - * acs@rmc_host[:rmc_port],ACS_NUMBER,LSM_NUMBER,PANEL_NUMBER,TRANSPORT_NUMBER - * manual - * smc@rmc_host[:rmc_port],drive_ordinal - * - * @return The loader type. - */ -int rmc_get_acs_drive_id(const char *const drive, - struct rmc_acs_drive_id *const drive_id); - diff --git a/mediachanger/castorrmc/h/rmc_get_loader_type.h b/mediachanger/castorrmc/h/rmc_get_loader_type.h deleted file mode 100644 index f993abf8f5..0000000000 --- a/mediachanger/castorrmc/h/rmc_get_loader_type.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -/****************************************************************************** - * Please note that this file is part of the internal API of the rmc daemon - * and its client software and should therefore not be distributed to end users - *****************************************************************************/ - -#pragma once - -typedef enum { - RMC_LOADER_TYPE_ACS, - RMC_LOADER_TYPE_MANUAL, - RMC_LOADER_TYPE_SMC, - RMC_LOADER_TYPE_UNKNOWN} rmc_loader_type; - -/** - * Returns the loader type of the specified drive string. - * - * There are three RMC loader types, namely acs, manual and smc. The drive - * string is expected to be in one of the following forms respectively: - * - * acs@rmc_host[:rmc_port],ACS_NUMBER,LSM_NUMBER,PANEL_NUMBER,TRANSPORT_NUMBER - * manual - * smc@rmc_host[:rmc_port],drive_ordinal - * - * @param drive The drive string. - * @return The loader type. - */ -rmc_loader_type rmc_get_loader_type(const char *const drive); - diff --git a/mediachanger/castorrmc/h/rmc_get_rmc_host_of_drive.h b/mediachanger/castorrmc/h/rmc_get_rmc_host_of_drive.h deleted file mode 100644 index 0dd130943f..0000000000 --- a/mediachanger/castorrmc/h/rmc_get_rmc_host_of_drive.h +++ /dev/null @@ -1,48 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -/****************************************************************************** - * Please note that this file is part of the internal API of the rmc daemon - * and its client software and should therefore not be distributed to end users - *****************************************************************************/ - -#pragma once - -/** - * Returns the rmc host of the specified drive string. The drive string either - * starts with: - * - * acs@rmc_host, - * or: - * - * smc@rmc_host, - * - * @param drive The drive string - * @param rmc_host_buf Output parameter. The buffer into which the rmc host - * should be written as a null terminated string. - * @param rmc_host_buflen The length of the rmc host buffer. - * @return 0 on success and -1 on failure. - */ -int rmc_get_rmc_host_of_drive(const char *const drive, - char *const rmc_host_buf, const int rmc_host_buflen); - diff --git a/mediachanger/castorrmc/h/rmc_procreq.h b/mediachanger/castorrmc/h/rmc_procreq.h index 3e95da8d9d..0cea59fed7 100644 --- a/mediachanger/castorrmc/h/rmc_procreq.h +++ b/mediachanger/castorrmc/h/rmc_procreq.h @@ -31,13 +31,10 @@ struct rmc_srv_rqst_context { const char *clienthost; }; -int rmc_srv_export(const struct rmc_srv_rqst_context *const rqst_context); +int rmc_srv_export (const struct rmc_srv_rqst_context *const rqst_context); int rmc_srv_findcart(const struct rmc_srv_rqst_context *const rqst_context); -int rmc_srv_getgeom(const struct rmc_srv_rqst_context *const rqst_context); -int rmc_srv_import(const struct rmc_srv_rqst_context *const rqst_context); -int rmc_srv_mount(const struct rmc_srv_rqst_context *const rqst_context); +int rmc_srv_getgeom (const struct rmc_srv_rqst_context *const rqst_context); +int rmc_srv_import (const struct rmc_srv_rqst_context *const rqst_context); +int rmc_srv_mount (const struct rmc_srv_rqst_context *const rqst_context); int rmc_srv_readelem(const struct rmc_srv_rqst_context *const rqst_context); -int rmc_srv_unmount(const struct rmc_srv_rqst_context *const rqst_context); -int rmc_srv_acs_mnt(const struct rmc_srv_rqst_context *const rqst_context); -int rmc_srv_acs_unmnt(const struct rmc_srv_rqst_context *const rqst_context); - +int rmc_srv_unmount (const struct rmc_srv_rqst_context *const rqst_context); diff --git a/mediachanger/castorrmc/rmc/rmc_dismount.c b/mediachanger/castorrmc/rmc/rmc_dismount.c index 1831f4f3f2..6b46901771 100644 --- a/mediachanger/castorrmc/rmc/rmc_dismount.c +++ b/mediachanger/castorrmc/rmc/rmc_dismount.c @@ -35,7 +35,7 @@ int rmc_dismount( sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_UNMOUNT); + marshall_LONG (sbp, RMC_UNMOUNT); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_export.c b/mediachanger/castorrmc/rmc/rmc_export.c index dd8d00f9fa..08bc1ccd03 100644 --- a/mediachanger/castorrmc/rmc/rmc_export.c +++ b/mediachanger/castorrmc/rmc/rmc_export.c @@ -30,7 +30,7 @@ int rmc_export(const char *const server, const char *const vid) sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_EXPORT); + marshall_LONG (sbp, RMC_EXPORT); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_find_cartridge.c b/mediachanger/castorrmc/rmc/rmc_find_cartridge.c index 890e1d1d98..8728ba2f4e 100644 --- a/mediachanger/castorrmc/rmc/rmc_find_cartridge.c +++ b/mediachanger/castorrmc/rmc/rmc_find_cartridge.c @@ -40,7 +40,7 @@ int rmc_find_cartridge( sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_FINDCART); + marshall_LONG (sbp, RMC_FINDCART); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_find_char.c b/mediachanger/castorrmc/rmc/rmc_find_char.c deleted file mode 100644 index ecd8ce3834..0000000000 --- a/mediachanger/castorrmc/rmc/rmc_find_char.c +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -#include "h/rmc_find_char.h" - -#include <string.h> - -int rmc_find_char(const char *const str, const char c) { - if(NULL != str) { - const int str_len = strlen(str); - int i = 0; - - for(i = 0; i < str_len; i++) { - if(c == str[i]) { - return i; - } - } - } - return -1; -} diff --git a/mediachanger/castorrmc/rmc/rmc_get_acs_drive_id.c b/mediachanger/castorrmc/rmc/rmc_get_acs_drive_id.c deleted file mode 100644 index 1fd34e07e4..0000000000 --- a/mediachanger/castorrmc/rmc/rmc_get_acs_drive_id.c +++ /dev/null @@ -1,123 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -#include "h/rmc_get_acs_drive_id.h" - -#include <string.h> - -/** - * A simple function that converts the string representation of the unsigned - * integer in the specified character buffer to an integer. - * - * @return A value of 0 or greater than 0 if the conversion was a success or -1 - * if the conversion was not a success. - */ -static int rmc_buf2uint(const char *const buf, int buflen) { - int i = 0; - int value = 0; - - /* Fail conversion if there is nothing to convert */ - if(NULL == buf || 0 == buflen) { - return -1; - } - - for(i = 0; i < buflen; i++) { - const char c = buf[i]; - - /* Fail conversion if the character is not a decimal digit */ - if(c < '0' || c > '9') { - return -1; - } - value *= 10; - value += (c - '0'); - } - return value; -} - -int rmc_get_acs_drive_id(const char *const drive, - struct rmc_acs_drive_id *const drive_id) { - int str_len = 0; - int i = 0; - int nbCommas = 0; - int commaIndex[4]; - - /* Fail if there is nothing to work on */ - if(NULL == drive) { - return -1; - } - - str_len = strlen(drive); - - /* An acs drive string starts with "acs@" */ - /* */ - /* Fail if the first 4 characters do not exist or are not as expected */ - if(4 > str_len || strncmp("acs@", drive, 4)) { - return -1; - } - - /* The drive string should be of the form */ - /* "acs@rmc_host,acs,lsm,panel,transport" */ - /* therefore there should be 4 commas (',') */ - - /* Find the expected 4 commas */ - for(i=0; i < str_len; i++) { - if(',' == drive[i]) { - /* Fail if there are too many commas */ - if(4 < nbCommas) { - return -1; - } - commaIndex[nbCommas] = i; - nbCommas++; - } - } - - /* Fail if there are too few commas */ - if(4 != nbCommas) { - return -1; - } - - /* Fail if the rmc_host has zero length */ - if(0 == commaIndex[0] - 3 /* index of at sign ('@') */) { - return -1; - } - - /* Try to convert the 4 drive id numbers to integers */ - drive_id->acs = rmc_buf2uint(drive + commaIndex[0] + 1, - commaIndex[1] - commaIndex[0] - 1); - drive_id->lsm = rmc_buf2uint(drive + commaIndex[1] + 1, - commaIndex[2] - commaIndex[1] - 1); - drive_id->panel = rmc_buf2uint(drive + commaIndex[2] + 1, - commaIndex[3] - commaIndex[2] - 1); - drive_id->transport = rmc_buf2uint(drive + commaIndex[3] + 1, - str_len - 1 - commaIndex[3]); - - /* Fail if one of the drive id numbers could not be converted */ - if( -1 == drive_id->acs || - -1 == drive_id->lsm || - -1 == drive_id->panel || - -1 == drive_id->transport) { - return -1; - } - - return 0; -} diff --git a/mediachanger/castorrmc/rmc/rmc_get_geometry.c b/mediachanger/castorrmc/rmc/rmc_get_geometry.c index b6937005be..16f7e42f5c 100644 --- a/mediachanger/castorrmc/rmc/rmc_get_geometry.c +++ b/mediachanger/castorrmc/rmc/rmc_get_geometry.c @@ -34,7 +34,7 @@ int rmc_get_geometry( sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_GETGEOM); + marshall_LONG (sbp, RMC_GETGEOM); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_get_loader_type.c b/mediachanger/castorrmc/rmc/rmc_get_loader_type.c deleted file mode 100644 index 1ceeb8c075..0000000000 --- a/mediachanger/castorrmc/rmc/rmc_get_loader_type.c +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -#include "h/rmc_get_loader_type.h" - -#include <string.h> - -rmc_loader_type rmc_get_loader_type(const char *const drive) { - if(strncmp("acs@", drive, 3) == 0) { - return RMC_LOADER_TYPE_ACS; - } else if(strcmp("manual", drive) == 0) { - return RMC_LOADER_TYPE_MANUAL; - } else if(strncmp("smc@", drive, 3) == 0) { - return RMC_LOADER_TYPE_SMC; - } else { - return RMC_LOADER_TYPE_UNKNOWN; - } -} diff --git a/mediachanger/castorrmc/rmc/rmc_get_rmc_host_of_drive.c b/mediachanger/castorrmc/rmc/rmc_get_rmc_host_of_drive.c deleted file mode 100644 index aef8fb3a45..0000000000 --- a/mediachanger/castorrmc/rmc/rmc_get_rmc_host_of_drive.c +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -#include "h/rmc_find_char.h" -#include "h/rmc_get_rmc_host_of_drive.h" - -#include <string.h> - -int rmc_get_rmc_host_of_drive(const char *const drive, - char *const rmc_host_buf, const int rmc_host_buflen) { - int indexOfComma = 0; - int rmc_host_len = 0; - - /* Fail if there is nothing to work on */ - if(NULL == drive || NULL == rmc_host_buf || 0 == rmc_host_buflen) { - return -1; - } - - /* Fail if the drive string does not start with either "acs@" or */ - /* "smc@" */ - if(strncmp("acs@", drive, 4) && strncmp("smc@", drive, 4)) { - return -1; - } - - /* The rmc_host should follow the at sign ('@') and be terminated by */ - /* a comma (',') for example "acs@rmc_host," */ - - indexOfComma = rmc_find_char(drive, ','); - rmc_host_len = indexOfComma - 3 /* index of the at sign */ - 1; - if( 0 >= rmc_host_len || /* rmc_host contains no characters */ - rmc_host_buflen <= rmc_host_len) { /* rmc_host is too long */ - return -1; - } - - memcpy(rmc_host_buf, drive + 4, rmc_host_len); - rmc_host_buf[rmc_host_len] = '\0'; - return 0; -} diff --git a/mediachanger/castorrmc/rmc/rmc_import.c b/mediachanger/castorrmc/rmc/rmc_import.c index 73e2280d6c..bc0d20e3ab 100644 --- a/mediachanger/castorrmc/rmc/rmc_import.c +++ b/mediachanger/castorrmc/rmc/rmc_import.c @@ -31,7 +31,7 @@ int rmc_import(const char *const server, const char *const vid) sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_IMPORT); + marshall_LONG (sbp, RMC_IMPORT); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_mnt.c b/mediachanger/castorrmc/rmc/rmc_mnt.c index 11b78e8ff7..ddb7202cbe 100644 --- a/mediachanger/castorrmc/rmc/rmc_mnt.c +++ b/mediachanger/castorrmc/rmc/rmc_mnt.c @@ -31,97 +31,49 @@ #include "h/marshall.h" #include "h/rmc_api.h" #include "h/rmc_constants.h" -#include "h/rmc_get_acs_drive_id.h" -#include "h/rmc_get_rmc_host_of_drive.h" -#include "h/rmc_get_loader_type.h" #include "h/serrno.h" #include <errno.h> #include <string.h> -static int rmc_acs_mnt(const char *const vid, const char *const drive); -static int rmc_manual_mnt(const char *const vid, const char *const drive); -static int rmc_smc_mnt(const char *const vid, const char *const drive); - -int rmc_mnt(const char *const vid, const char *const drive) { - /* If there is nothing to work on then return EINVAL */ - if(NULL == vid || NULL == drive) { - errno = EINVAL; - serrno = errno; - return -1; - } - - if(CA_MAXVIDLEN < strlen(vid)) { - errno = ERMCVIDTOOLONG; /* VID is too long */ - serrno = errno; - return -1; - } - - switch(rmc_get_loader_type(drive)) { - case RMC_LOADER_TYPE_ACS: - return rmc_acs_mnt(vid, drive); - case RMC_LOADER_TYPE_MANUAL: - return rmc_manual_mnt(vid, drive); - case RMC_LOADER_TYPE_SMC: - return rmc_smc_mnt(vid, drive); - default: - errno = ERMCUKNLDRTYPE; /* Unknown loader type */ - serrno = errno; - return -1; - } -} - -static int rmc_acs_mnt(const char *const vid, const char *const drive) { +int rmc_mnt( + const char *const server, + const char *const vid, + const char *const loader) +{ const gid_t gid = getgid(); const uid_t uid = getuid(); /* The total length of the fixed size members of the request message */ - /* is Magic (4 bytes) + request ID (4 bytes) + msglen (4 bytes) + */ - /* uid (4 bytes) + gid (4 bytes) + ACS number (4 bytes) + LSM number */ - /* (4 bytes) + panel number (4 bytes) + transport number (4 bytes) = */ - /* 40 bytes */ - const int msglen = 40 + strlen(vid); + /* is Magic (4 bytes) + request ID (4 bytes) + length (4 bytes) + */ + /* uid (4 bytes) + gid (4 bytes) = 20 bytes */ + const int msglen = 20 + strlen(vid) + 1 + strlen(loader) + 1; char repbuf[1]; char *sbp = NULL; char sendbuf[RMC_REQBUFSZ]; - char rmc_host[CA_MAXHOSTNAMELEN+1]; - struct rmc_acs_drive_id drive_id = {0, 0, 0, 0}; - - if(rmc_get_rmc_host_of_drive(drive, rmc_host, sizeof(rmc_host))) { - errno = ERMCPARSERMCHOST; /* Failed to parse RMC host */ - serrno = errno; - return -1; - } - - if(rmc_get_acs_drive_id(drive, &drive_id)) { - errno = ERMCPARSEACSDRV; /* Failed to parse ACS drive id */ - serrno = errno; - return -1; - } - /* It is an internal error if the total size of the request message */ - /* would be greater than RMC_REQBUFSZ */ + /* Consider the function arguments invalid if the total size of the */ + /* request message would be greater than RMC_REQBUFSZ */ if(msglen > RMC_REQBUFSZ) { - errno = SEINTERNAL; + errno = ERMCUNREC; serrno = errno; return -1; } /* Build request header */ + sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_ACS_MOUNT); + marshall_LONG (sbp, RMC_MOUNT); marshall_LONG (sbp, msglen); /* Build request body */ + marshall_LONG (sbp, uid); marshall_LONG (sbp, gid); - marshall_LONG (sbp, drive_id.acs); - marshall_LONG (sbp, drive_id.lsm); - marshall_LONG (sbp, drive_id.panel); - marshall_LONG (sbp, drive_id.transport); marshall_STRING (sbp, vid); + marshall_STRING (sbp, loader); /* Being paranoid; checking the calculated message length against */ /* the number of bytes marshalled */ @@ -131,15 +83,5 @@ static int rmc_acs_mnt(const char *const vid, const char *const drive) { return -1; } - return send2rmc (rmc_host, sendbuf, msglen, repbuf, sizeof(repbuf)); -} - -static int rmc_manual_mnt(const char *const vid, const char *const drive) { - /* Return 1 indicating the mount is manual */ - return 1; -} - -static int rmc_smc_mnt(const char *const vid, const char *const drive) { - - return 0; + return send2rmc (server, sendbuf, msglen, repbuf, sizeof(repbuf)); } diff --git a/mediachanger/castorrmc/rmc/rmc_mnt.man b/mediachanger/castorrmc/rmc/rmc_mnt.man index 421b63ab6c..144854e59c 100644 --- a/mediachanger/castorrmc/rmc/rmc_mnt.man +++ b/mediachanger/castorrmc/rmc/rmc_mnt.man @@ -9,56 +9,46 @@ rmc_mnt \- send a request to the Remote Media Changer daemon to have a volume mo .br \fB#include "rmc_api.h"\fR .sp -.BI "int \fBrmc_mnt\f[](const char *const \fIvid\f[], const char *const \fIdrive\f[]); +.BI "int rmc_mnt (char *" server , +.BI "char *" vid , +.BI "char *" loader ); .SH DESCRIPTION .B rmc_mnt -asks the remote media-changer daemon to mount the volume +asks the Remote Media Changer server running on +.I server +to mount the volume .I vid on the drive specified by -.IR drive . +.IR loader . +.TP +.I server +specifies the Remote Media Changer to be contacted. .TP .I vid is the volume visual identifier. It must be at most six characters long. .TP -.I drive -specifies the drive in one of the following three forms corresponding to the three supported drive-loader types, namely acs, manual and smc: +.I loader +specifies the drive in the robot in the following form: .RS .TP -acsACS_NUMBER,LSM_NUMBER,PANEL_NUMBER,TRANSPORT_NUMBER -.TP -manual -.TP -smc@rmc_host,drive_ordinal +smc@hostname,drive_ordinal .RE .LP This function requires TP_SYSTEM privilege in the Cupv database. .SH RETURN VALUE -.TP -.B 0 -The mount operation was successful. -.TP -.B 1 -The mount operations is manual and the rmc_mnt() function has therefore not -taken any further action. -.TP -.B -1 -The mount operation has failed and both -.B errno -and +This routine returns 0 if the operation was successful or -1 if the operation +failed. In the latter case, .B serrno have been set appropriately. .SH ERRORS -.TP 1.8i -.B EINVAL -If either \fIvid\f[] or \fIdrive\f[] are passed a NULL pointer. -.TP +.TP 1.2i .B SECOMERR Communication error. .TP .B ERMCUNREC -Unknown host or invalid drive or requester does not have +Unknown host or invalid loader or vid too long or requester does not have TP_SYSTEM privilege in the Cupv database. .TP .B ERMCFASTR @@ -66,21 +56,6 @@ Unit attention. .TP .B ERMCOMSGR Hardware error or Medium Removal Prevented. -.TP -.B ERMCUKNLDRTYPE -Unknown drive-loader type. -.TP -.B ERMCVIDTOOLONG -VID is too long. -.TP -.B ERMCPARSERMCHOST -Failed to parse RMC host. -.TP -.B ERMCPARSEACSDRV -Failed to parse ACS drive id. -.TP -.B SEINTERNAL -Internal error. .SH SEE ALSO .BR Cupvlist(3) .SH AUTHOR diff --git a/mediachanger/castorrmc/rmc/rmc_mount.c b/mediachanger/castorrmc/rmc/rmc_mount.c index 94abde365e..aa72260c32 100644 --- a/mediachanger/castorrmc/rmc/rmc_mount.c +++ b/mediachanger/castorrmc/rmc/rmc_mount.c @@ -35,7 +35,7 @@ int rmc_mount( sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_MOUNT); + marshall_LONG (sbp, RMC_MOUNT); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_procreq.c b/mediachanger/castorrmc/rmc/rmc_procreq.c index 07efc5a385..616a529c41 100644 --- a/mediachanger/castorrmc/rmc/rmc_procreq.c +++ b/mediachanger/castorrmc/rmc/rmc_procreq.c @@ -407,8 +407,7 @@ int rmc_srv_unmount(const struct rmc_srv_rqst_context *const rqst_context) { uid_t uid; char vid[CA_MAXVIDLEN+1]; - strncpy (func, "rmc_srv_unmount", sizeof(func)); - func[sizeof(func) - 1] = '\0'; + strncpy (func, "rmc_srv_unmount", 16); rbp = rqst_context->req_data; unmarshall_LONG (rbp, uid); unmarshall_LONG (rbp, gid); @@ -448,30 +447,10 @@ int rmc_srv_unmount(const struct rmc_srv_rqst_context *const rqst_context) { return c; } -/* rmc_srv_acs_mnt - mount a cartridge into a drive in an ACS compatible */ -/* tape library */ - -int rmc_srv_acs_mnt( - const struct rmc_srv_rqst_context *const rqst_context) { - char func[16]; - strncpy (func, "rmc_srv_acs_mnt", sizeof(func)); - func[sizeof(func) - 1] = '\0'; - - rmc_logreq (func, "Called"); - +int rmc_srv_genericmount(struct rmc_srv_rqst_context *const rqst_context) { return 0; } -/* rmc_srv_acs_unmnt - unmount a cartridge from a drive in an ACS */ -/* compatible tape library */ - -int rmc_srv_acs_unmnt( - const struct rmc_srv_rqst_context *const rqst_context) { - char func[18]; - strncpy (func, "rmc_srv_acs_unmnt", sizeof(func)); - func[sizeof(func) - 1] = '\0'; - - rmc_logreq (func, "Called"); - +int rmc_srv_genericunmount(struct rmc_srv_rqst_context *const rqst_context) { return 0; } diff --git a/mediachanger/castorrmc/rmc/rmc_read_elem_status.c b/mediachanger/castorrmc/rmc/rmc_read_elem_status.c index 07dd2a3799..551c256b82 100644 --- a/mediachanger/castorrmc/rmc/rmc_read_elem_status.c +++ b/mediachanger/castorrmc/rmc/rmc_read_elem_status.c @@ -39,7 +39,7 @@ int rmc_read_elem_status( sbp = sendbuf; marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_SCSI_READELEM); + marshall_LONG (sbp, RMC_READELEM); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); diff --git a/mediachanger/castorrmc/rmc/rmc_serv.c b/mediachanger/castorrmc/rmc/rmc_serv.c index 8311fe2c6f..b22567a3f2 100644 --- a/mediachanger/castorrmc/rmc/rmc_serv.c +++ b/mediachanger/castorrmc/rmc/rmc_serv.c @@ -436,16 +436,14 @@ static int dispatchRqstHandlerWithFastRetry(const int req_type, */ static const char *rmc_req_type_to_str(const int req_type) { switch (req_type) { - case RMC_SCSI_MOUNT : return "RMC_SCSI_MOUNT"; - case RMC_SCSI_UNMOUNT : return "RMC_SCSI_UNMOUNT"; - case RMC_SCSI_EXPORT : return "RMC_SCSI_EXPORT"; - case RMC_SCSI_IMPORT : return "RMC_SCSI_IMPORT"; - case RMC_SCSI_GETGEOM : return "RMC_SCSI_GETGEOM"; - case RMC_SCSI_READELEM: return "RMC_SCSI_READELEM"; - case RMC_SCSI_FINDCART: return "RMC_SCSI_FINDCART"; - case RMC_ACS_MOUNT : return "RMC_ACS_MOUNT"; - case RMC_ACS_UNMOUNT : return "RMC_ACS_UNMOUNT"; - default : return "UNKNOWN"; + case RMC_MOUNT : return "RMC_MOUNT"; + case RMC_UNMOUNT : return "RMC_UNMOUNT"; + case RMC_EXPORT : return "RMC_EXPORT"; + case RMC_IMPORT : return "RMC_IMPORT"; + case RMC_GETGEOM : return "RMC_GETGEOM"; + case RMC_READELEM: return "RMC_READELEM"; + case RMC_FINDCART: return "RMC_FINDCART"; + default : return "UNKNOWN"; } } @@ -459,24 +457,20 @@ static const char *rmc_req_type_to_str(const int req_type) { static int dispatchRqstHandler(const int req_type, const struct rmc_srv_rqst_context *const rqst_context) { switch (req_type) { - case RMC_SCSI_MOUNT: + case RMC_MOUNT: return rmc_srv_mount (rqst_context); - case RMC_SCSI_UNMOUNT: + case RMC_UNMOUNT: return rmc_srv_unmount (rqst_context); - case RMC_SCSI_EXPORT: + case RMC_EXPORT: return rmc_srv_export (rqst_context); - case RMC_SCSI_IMPORT: + case RMC_IMPORT: return rmc_srv_import (rqst_context); - case RMC_SCSI_GETGEOM: + case RMC_GETGEOM: return rmc_srv_getgeom (rqst_context); - case RMC_SCSI_READELEM: + case RMC_READELEM: return rmc_srv_readelem (rqst_context); - case RMC_SCSI_FINDCART: + case RMC_FINDCART: return rmc_srv_findcart (rqst_context); - case RMC_ACS_MOUNT: - return rmc_srv_acs_mnt (rqst_context); - case RMC_ACS_UNMOUNT: - return rmc_srv_acs_unmnt (rqst_context); default: return ERMCUNREC; } diff --git a/mediachanger/castorrmc/rmc/rmc_unmnt.c b/mediachanger/castorrmc/rmc/rmc_unmnt.c deleted file mode 100644 index cf9800d074..0000000000 --- a/mediachanger/castorrmc/rmc/rmc_unmnt.c +++ /dev/null @@ -1,145 +0,0 @@ -/****************************************************************************** - * - * This file is part of the Castor project. - * See http://castor.web.cern.ch/castor - * - * Copyright (C) 2003 CERN - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * - * - * @author Castor Dev team, castor-dev@cern.ch - *****************************************************************************/ - -/* rmc_unmnt - unmount a cartridge from a drive that maybe in either */ -/* a SCSI compatible or an ACS compatible tape library */ - -#include <stdlib.h> -#include <sys/types.h> -#include <unistd.h> -#include <netinet/in.h> -#include "h/marshall.h" -#include "h/rmc_api.h" -#include "h/rmc_constants.h" -#include "h/rmc_get_acs_drive_id.h" -#include "h/rmc_get_rmc_host_of_drive.h" -#include "h/rmc_get_loader_type.h" -#include "h/serrno.h" - -#include <errno.h> -#include <string.h> - -static int rmc_acs_unmnt(const char *const vid, const char *const drive); -static int rmc_manual_unmnt(const char *const vid, const char *const drive); -static int rmc_smc_unmnt(const char *const vid, const char *const drive); - -int rmc_unmnt(const char *const vid, const char *const drive) { - /* If there is nothing to work on then return EINVAL */ - if(NULL == vid || NULL == drive) { - errno = EINVAL; - serrno = errno; - return -1; - } - - if(CA_MAXVIDLEN < strlen(vid)) { - errno = ERMCVIDTOOLONG; /* VID is too long */ - serrno = errno; - return -1; - } - - switch(rmc_get_loader_type(drive)) { - case RMC_LOADER_TYPE_ACS: - return rmc_acs_unmnt(vid, drive); - case RMC_LOADER_TYPE_MANUAL: - return rmc_manual_unmnt(vid, drive); - case RMC_LOADER_TYPE_SMC: - return rmc_smc_unmnt(vid, drive); - default: - errno = ERMCUNREC; - serrno = errno; - return -1; - } -} - -int rmc_acs_unmnt(const char *const vid, const char *const drive) { - const gid_t gid = getgid(); - const uid_t uid = getuid(); - - /* The total length of the fixed size members of the request message */ - /* is Magic (4 bytes) + request ID (4 bytes) + msglen (4 bytes) + */ - /* uid (4 bytes) + gid (4 bytes) + ACS number (4 bytes) + LSM number */ - /* (4 bytes) + panel number (4 bytes) + transport number (4 bytes) = */ - /* 40 bytes */ - const int msglen = 40 + strlen(vid); - - char repbuf[1]; - char *sbp = NULL; - char sendbuf[RMC_REQBUFSZ]; - char rmc_host[CA_MAXHOSTNAMELEN+1]; - struct rmc_acs_drive_id drive_id = {0, 0, 0, 0}; - - if(rmc_get_rmc_host_of_drive(drive, rmc_host, sizeof(rmc_host))) { - errno = ERMCPARSERMCHOST; /* Failed to parse RMC host */ - serrno = errno; - return -1; - } - - if(rmc_get_acs_drive_id(drive, &drive_id)) { - errno = ERMCPARSEACSDRV; /* Failed to parse ACS drive id */ - serrno = errno; - return -1; - } - - /* It is an internal error if the total size of the request message */ - /* would be greater than RMC_REQBUFSZ */ - if(msglen > RMC_REQBUFSZ) { - errno = SEINTERNAL; - serrno = errno; - return -1; - } - - /* Build request header */ - sbp = sendbuf; - marshall_LONG (sbp, RMC_MAGIC); - marshall_LONG (sbp, RMC_ACS_UNMOUNT); - marshall_LONG (sbp, msglen); - - /* Build request body */ - marshall_LONG (sbp, uid); - marshall_LONG (sbp, gid); - marshall_LONG (sbp, drive_id.acs); - marshall_LONG (sbp, drive_id.lsm); - marshall_LONG (sbp, drive_id.panel); - marshall_LONG (sbp, drive_id.transport); - marshall_STRING (sbp, vid); - - /* Being paranoid; checking the calculated message length against */ - /* the number of bytes marshalled */ - if(sbp - sendbuf != msglen) { - errno = SEINTERNAL; - serrno = errno; - return -1; - } - - return send2rmc (rmc_host, sendbuf, msglen, repbuf, sizeof(repbuf)); -} - -static int rmc_manual_unmnt(const char *const vid, const char *const drive) { - - return 0; -} - -static int rmc_smc_unmnt(const char *const vid, const char *const drive) { - - return 0; -} diff --git a/mediachanger/castorrmc/rmc/rmc_unmnt.man b/mediachanger/castorrmc/rmc/rmc_unmnt.man deleted file mode 100644 index 98b7d1f9e7..0000000000 --- a/mediachanger/castorrmc/rmc/rmc_unmnt.man +++ /dev/null @@ -1,78 +0,0 @@ -.\" Copyright (C) 2002 by CERN/IT/PDP/DM -.\" All rights reserved -.\" -.TH RMC_UNMNT 3 "$Date: 2013/11/18 16:21:00 $" CASTOR "rmc Library Functions" -.SH NAME -rmc_unmnt \- send a request to the Remote Media Changer daemon to have a volume unmounted -.SH SYNOPSIS -.B #include <sys/types.h> -.br -\fB#include "rmc_api.h"\fR -.sp -int \fBrmc_unmnt\f[](const char *const \fIvid\f[], const char *const \fIdrive\f[]); -.SH DESCRIPTION -.B rmc_unmnt -asks the Remote media-changer daemon (rmcd) to unmount the volume -.I vid -from the drive specified by -.IR drive . -.TP -.I vid -is the volume visual identifier. -It must be at most six characters long. -.TP -.I drive -specifies the drive in one of the following three forms corresponding to the three supported drive-loader types, namely acs, manual and smc: -.RS -.TP -acsACS_NUMBER,LSM_NUMBER,PANEL_NUMBER,TRANSPORT_NUMBER -.TP -manual -.TP -smc@rmc_host,drive_ordinal -.RE - -.LP -This function requires TP_SYSTEM privilege in the Cupv database. -.SH RETURN VALUE -This routine returns 0 if a unmount operation was successful, 1 if the unmount -is manual and therefore the system is now waiting for an operator to perform the -unmount, or -1 if the operation failed. In the latter case, -.B serrno -is set appropriately. -.SH ERRORS -.TP 1.2i -.B EINVAL -If either \fIvid\f[] or \fIdrive\f[] are passed a NULL pointer. -.TP -.B SECOMERR -Communication error. -.TP -.B ERMCUNREC -Unknown host or invalid drive or vid too long or requester does not have -TP_SYSTEM privilege in the Cupv database. -.TP -.B ERMCFASTR -Unit attention. -.TP -.B ERMCOMSGR -Hardware error or Medium Removal Prevented. -.TP -.B ERMCUKNLDRTYPE -Unknown drive-loader type. -.TP -.B ERMCVIDTOOLONG -VID is too long. -.TP -.B ERMCPARSERMCHOST -Failed to parse RMC host. -.TP -.B ERMCPARSEACSDRV -Failed to parse ACS drive id. -.TP -.B SEINTERNAL -Internal error -.SH SEE ALSO -.BR Cupvlist(3) -.SH AUTHOR -\fBCASTOR\fP Team <castor.support@cern.ch> diff --git a/mediachanger/castorrmc/rmc/rmcd.man b/mediachanger/castorrmc/rmc/rmcd.man index 3fa1649aaf..51e08b0ad1 100644 --- a/mediachanger/castorrmc/rmc/rmcd.man +++ b/mediachanger/castorrmc/rmc/rmcd.man @@ -5,72 +5,77 @@ .SH NAME rmcd \- start the Remote Media Changer daemon .SH SYNOPSIS -.B rmcd [OPTIONS] +.B rmcd +.I smc_ldr .SH DESCRIPTION .LP The .B rmcd command starts the Remote Media Changer daemon. -.SH OPTIONS -.TP -\fB\-f -Remain in the foreground. -.SH CASTOR CONFIGURATION PARAMETERS READ BY THE SERVER -The remote media changer daemon reads and uses the following CASTOR -configuration parameters which are specified within the CASTOR -configuration file /etc/castor/castor.conf. -.TP -\fBRMC MODE -The compatibility mode of the the remote media-changer daemon. Valid values -are ACS, MOCK and SMC. A remote media-changer daemon can either be configured -to work with an ACS compatible tape library or with a SCSI compatible tape -library. In addition a remote media-changer daemon can be configured to run -in MOCK mode for debugging purposes. In MOCK mode a remote media-changer will -do nothing but log the client requests it receives. It is \fBNOT\f[] -recommended to run a remote media-changer daemon in MOCK mode in production -unless you really know what you are doing. -.TP -\fBRMC PORT -The port on which the remote media changer daemon will listen for client -requests. The default value is 5014. This configuration parameter should -\fBNOT\fP normally be set and the default should be used. -.TP -\fBRMC SMCDEV -The path to the device file representing the SCSI media changer. This -configuration parameter is only read by a remote media-changer daemon -configured to run in SMC compatibility mode. See \fBRMC MODE\f[] above. - -.SH CASTOR CONFIGURATION PARAMETERS READ BY THE CLIENTS -The clients of the remote media changer daemon read and use the following -CASTOR configuration parameters which are specified within the CASTOR -configuration file /etc/castor/castor.conf. -.TP -\fBRMC HOST -The host on which the rmcd daemon is running and listening for client requests. -.TP -\fBRMC PORT -The port on which the remote media changer daemon will listen for client -requests. The default value is 5014. This configuration parameter should -\fBNOT\fP normally be set and the default should be used. - -.SH ENVIRONMENT VARIABLES READ BY THE CLIENTS -The clients of the remote media changer daemon read and use the following -environment variables. Please note that an environment variable will override -the equivalent CASTOR configuration parameter located within the CASTOR -configuration file /etc/castor/castor.conf. -.TP -\fBRMC_HOST -The same meaning as the CASTOR configuration parameter \fBRMC HOST\f[] -described above. -.TP -\fBRMC_PORT -The same meaning as the CASTOR configuration parameter \fBRMC PORT\f[] described -above. - -.SH THE SERVER LOG FILE +This command is usually executed at system startup time +.RB ( /etc/rc.local ). +.LP +.I smc_ldr +is the picker device as defined in /dev. +.LP +If the Remote Media Changer daemon is not active, +the requests are automatically retried by the client API. +.LP +All error messages and statistical information are kept in a log. +.LP +The Remote Media Changer daemon listen port number can be defined on client +hosts and on the Remote Media Changer host itself in either of the following +ways: +.RS +.LP +setting an environment variable RMC_PORT +.RS +.HP +setenv RMC_PORT 5014 +.RE +.LP +an entry in +.B /etc/castor/castor.conf +like: +.RS +.HP +RMC PORT 5014 +.RE +.LP +an entry in +.B /etc/services +like: +.RS +.HP +rmc 5014/tcp # CASTOR Remote Media Changer +.RE +.RE +.LP +If none of these methods is used, the default port number is taken from the +definition of RMC_PORT in rmc_constants.h. +.LP +The Remote Media Changer host name can be defined on client hosts +in either of the following ways: +.RS +.LP +setting an environment variable RMC_HOST, for example: +.RS +.HP +setenv RMC_HOST castor5 +.RE +.LP +an entry in +.B /etc/castor/castor.conf +for example: +.RS +.HP +RMC HOST castor5 +.RE +.RE +.LP +If none of these methods is used, the default host is the local host. .LP -All error messages and statistical information are written to the file -/var/log/castor/rmcd.log. Each entry within the log has a timestamp. +In the log each entry has a timestamp. For each user command there is one message RMC92 giving information about the requestor (hostname, uid, gid) and one message RMC98 giving the command itself. -- GitLab