mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
dirpath-support-configure-path-options-and-decanonicalization-20010906
Sam's notes: "Here is a patch that supports directory paths, documentation for the above and decanonicalization of of supplied paths. Here are tests I have run: * Build with both transarc and non-transarc paths and examined dirpath.o * Build with roughly FHS-style paths and tested on Debian * confirmed that bos salvage works even when salvager not in /usr/afs/bin (it gets the log correctly too) * confirms that bos getlog can get logs from /usr/afs/logs even when /ur/afs/logs is /var/lib/openafs/logs * confirmed that bos getlog can get /etc/motd "
This commit is contained in:
parent
5caf0b44b3
commit
11b021e1b1
8
NEWS
8
NEWS
@ -1,5 +1,13 @@
|
||||
Openafs News -- history of user Visible changes. 11 July 2001
|
||||
|
||||
* Changes since OpenAFS 1.1.1
|
||||
|
||||
** AFS now supports --prefix and the other directory options of
|
||||
configure. By default AFS builds assuming it will be installed in
|
||||
/usr/local. In order to get traditional AFS directory paths (/usr/afs
|
||||
and /usr/vice/etc) use the --enable-transarc-paths option to
|
||||
configure. More details on the new directory layout are found in README.
|
||||
|
||||
* Changes since Openafs 1.0
|
||||
|
||||
** AFS now builds with configure. The README for building has been
|
||||
|
27
README
27
README
@ -37,9 +37,9 @@ A. Creating the proper directory structure.
|
||||
|
||||
2. Using configure in the top level directory, configure for your
|
||||
AFS system type, providing the necessary flags:
|
||||
% ./configure --with-afs-sysname=sun4x_58
|
||||
% ./configure --with-afs-sysname=sun4x_58 --enable-transarc-paths
|
||||
|
||||
For Linux systems you need also provide the patch in which your
|
||||
For Linux systems you need also provide the path in which your
|
||||
kernel headers for your configured kernel can be found. This should
|
||||
be the path of the directory containing a child directory named
|
||||
"include". So if your version file was
|
||||
@ -55,6 +55,29 @@ A. Creating the proper directory structure.
|
||||
or insecure software included with OpenAFS. See README.obsolete and
|
||||
README.insecure for more details.
|
||||
|
||||
There are two modes for directory path handling: "Transarc mode" and "default mode":
|
||||
- In Transarc mode, we retain compatibility with Transarc/IBM AFS tools
|
||||
by putting client configuaration files in /usr/vice/etc, and server
|
||||
files in /usr/afs under the traditional directory layout.
|
||||
- In default mode, files are located in standardized locations, usually
|
||||
under $(prefix).
|
||||
- Client programs, libraries, and related files always go in standard
|
||||
directories under $(prefix). This rule covers things that would go
|
||||
into $(bindir), $(includedir), $(libdir), $(mandir), and $(sbindir).
|
||||
- Other files get located in the following places:
|
||||
|
||||
Directory Transarc Mode Default Mode
|
||||
============ ========================= ==============================
|
||||
viceetcdir /usr/vice/etc $(sysconfdir)/openafs
|
||||
afssrvdir /usr/afs/bin (servers) $(libexecdir)/openafs
|
||||
afsconfdir /usr/afs/etc $(sysconfdir)/openafs/server
|
||||
afslocaldir /usr/afs/local $(localstatedir)/openafs
|
||||
afsdbdir /usr/afs/db $(localstatedir)/openafs/db
|
||||
afslogdir /usr/afs/logs $(localstatedir)/openafs/logs
|
||||
afsbosconfig $(afslocaldir)/BosConfig $(afsconfdir)/BosConfig
|
||||
afsbosserver $(afsbindir)/bosserver $(sbindir)/bosserver
|
||||
|
||||
|
||||
B Building
|
||||
|
||||
1. Now, you can build OpenAFS.
|
||||
|
36
configure.in
36
configure.in
@ -35,6 +35,9 @@ AC_ARG_ENABLE(kernel-module,
|
||||
AC_ARG_ENABLE(redhat-buildsys,
|
||||
[ --enable-redhat-buildsys enable compilation of the redhat build system kernel (defaults to disabled)],, enable_redhat_buildsys="no"
|
||||
)
|
||||
AC_ARG_ENABLE(transarc-paths,
|
||||
[ --enable-transarc-paths Use Transarc style paths like /usr/afs and /usr/vice],, enable_transarc_paths="no"
|
||||
)
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
@ -392,6 +395,39 @@ AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
|
||||
|
||||
AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
|
||||
|
||||
dnl Directory PATH handling
|
||||
if test "x$enable_transarc_paths" = "xyes" ; then
|
||||
afsconfdir=${afsconfdir=/usr/afs/etc}
|
||||
viceetcdir=${viceetcdir=/usr/vice/etc}
|
||||
afssrvdir=${afssrvdir=/usr/afs/bin}
|
||||
afsdbdir=${afsdbdir=/usr/afs/db}
|
||||
afslogsdir=${afslogsdir=/usr/afs/logs}
|
||||
afslocaldir=${afslocaldir=/usr/afs/local}
|
||||
afsbackupdir=${afsbackupdir=/usr/afs/backup}
|
||||
afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
|
||||
afsbosserverdir=${afsbosserverdir=/usr/afs/bin}
|
||||
else
|
||||
afsconfdir=${afsconfdir=$sysconfdir/openafs/server}
|
||||
viceetcdir=${viceetcdir=$sysconfdir/openafs}
|
||||
afssrvdir=${afssrvdir=$libexecdir/openafs}
|
||||
afsdbdir=${afsdbdir=$localstatedir/openafs/db}
|
||||
afslogsdir=${afslogsdir=$localstatedir/openafs/logs}
|
||||
afslocaldir=${afslocaldir=$localstatedir/openafs}
|
||||
afsbackupdir=${afsbackupdir=$localstatedir/openafs/backup}
|
||||
afsbosconfigdir=${afsbosconfigdir=$sysconfdir/openafs}
|
||||
afsbosserverdir=${afsbosserverdir=$sbindir}
|
||||
|
||||
fi
|
||||
AC_SUBST(afsconfdir)
|
||||
AC_SUBST(viceetcdir)
|
||||
AC_SUBST(afssrvdir)
|
||||
AC_SUBST(afsdbdir)
|
||||
AC_SUBST(afslogsdir)
|
||||
AC_SUBST(afslocaldir)
|
||||
AC_SUBST(afsbackupdir)
|
||||
AC_SUBST(afsbosconfigdir)
|
||||
AC_SUBST(afsbosserverdir)
|
||||
|
||||
if test "x$enable_kernel_module" = "xyes"; then
|
||||
ENABLE_KERNEL_MODULE=libafs
|
||||
fi
|
||||
|
@ -9,6 +9,17 @@ DESTDIR=@DESTDIR@
|
||||
SRCDIR=@SRCDIR@
|
||||
TOP_SRCDIR=@TOP_SRCDIR@
|
||||
SYS_NAME=@AFS_SYSNAME@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
afsconfdir=@afsconfdir@
|
||||
viceetcdir=@viceetcdir@
|
||||
afssrvdir=@afssrvdir@
|
||||
afsdbdir=@afsdbdir@
|
||||
afslogsdir=@afslogsdir@
|
||||
afslocaldir=@afslocaldir@
|
||||
afsbackupdir=@afsbackupdir@
|
||||
afsbosconfigdir=@afsbosconfigdir@
|
||||
afsbosserverdir=@afsbosserverdir@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
@ -24,6 +35,19 @@ objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
|
||||
|
||||
all: install
|
||||
|
||||
dirpath.h: dirpath.hin Makefile
|
||||
( sed \
|
||||
-e "s+@afsconfdir+${afsconfdir}+" \
|
||||
-e "s+@viceetcdir+${viceetcdir}+" \
|
||||
-e "s+@afssrvdir+${afssrvdir}+" \
|
||||
-e "s+@afsdbdir+${afsdbdir}+" \
|
||||
-e "s+@afslogsdir+${afslogsdir}+" \
|
||||
-e "s+@afslocaldir+${afslocaldir}+" \
|
||||
-e "s+@afsbackupdir+${afsbackupdir}+" \
|
||||
-e "s+@afsbosconfigdir+${afsbosconfigdir}+" \
|
||||
-e "s+@afsbosserverdir+${afsbosserverdir}+" \
|
||||
dirpath.hin >dirpath.h.tmp && \
|
||||
mv dirpath.h.tmp dirpath.h )
|
||||
util.a: ${objects} AFS_component_version_number.o
|
||||
$(RM) -f util.a
|
||||
$(AR) crv util.a ${objects} AFS_component_version_number.o
|
||||
@ -266,7 +290,7 @@ ${UKDIR}/afs_lhash.h: afs_lhash.h
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) -f ${objects} sys
|
||||
$(RM) -f ${objects} sys dirpath.h
|
||||
$(RM) -f util.a *.o core AFS_component_version_number.c
|
||||
|
||||
test:
|
||||
|
@ -61,16 +61,16 @@ static void initDirPathArray(void);
|
||||
/* Additional macros for ease of use */
|
||||
/* buf is expected to be atleast AFS_PATH_MAX bytes long */
|
||||
#define AFSDIR_SERVER_DIRPATH(buf, dir) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, dirPathArray[AFSDIR_SERVER_AFS_DIRPATH_ID], "/", dir, NULL)
|
||||
strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, NULL)
|
||||
|
||||
#define AFSDIR_SERVER_FILEPATH(buf, dir, file) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, dirPathArray[AFSDIR_SERVER_AFS_DIRPATH_ID], "/", dir, "/", file, NULL)
|
||||
strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, "/", file, NULL)
|
||||
|
||||
#define AFSDIR_CLIENT_DIRPATH(buf, dir) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, dirPathArray[AFSDIR_CLIENT_VICE_DIRPATH_ID], "/", dir, NULL)
|
||||
strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, NULL)
|
||||
|
||||
#define AFSDIR_CLIENT_FILEPATH(buf, dir, file) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, dirPathArray[AFSDIR_CLIENT_VICE_DIRPATH_ID], "/", dir, "/", file, NULL)
|
||||
strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, "/", file, NULL)
|
||||
|
||||
|
||||
/* initAFSDirPath() -- External users call this function to initialize
|
||||
@ -105,7 +105,9 @@ unsigned int initAFSDirPath(void)
|
||||
static void initDirPathArray(void)
|
||||
{
|
||||
char *pathp;
|
||||
|
||||
const char * clientPrefix = "";
|
||||
const char * serverPrefix = "";
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
char *buf;
|
||||
int status;
|
||||
@ -145,6 +147,7 @@ static void initDirPathArray(void)
|
||||
strcpy(ntClientConfigDirShort, ntClientConfigDirLong);
|
||||
}
|
||||
FilepathNormalize(ntClientConfigDirShort);
|
||||
clientPrefix = ntClientConfigDirShort;
|
||||
|
||||
/* setup the root server directory path (/usr/afs equivalent) */
|
||||
strcpy(afsSrvDirPath, ntServerInstallDirShort);
|
||||
@ -155,6 +158,7 @@ static void initDirPathArray(void)
|
||||
|
||||
/* setup top level dirpath (/usr equivalent); valid for server ONLY */
|
||||
strcpy(dirPathArray[AFSDIR_USR_DIRPATH_ID], ntServerInstallDirShort);
|
||||
serverPrefix = ntInstallDirShort;
|
||||
strcat(dirPathArray[AFSDIR_USR_DIRPATH_ID], AFSDIR_CANONICAL_USR_DIRPATH);
|
||||
|
||||
#else /* AFS_NT40_ENV */
|
||||
@ -182,10 +186,10 @@ static void initDirPathArray(void)
|
||||
strcpy(dirPathArray[AFSDIR_SERVER_AFS_DIRPATH_ID], afsSrvDirPath);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_ETC_DIRPATH_ID];
|
||||
AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_ETC_DIR);
|
||||
AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_SERVER_ETC_DIR);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BIN_DIRPATH_ID];
|
||||
AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_BIN_DIR);
|
||||
AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_SERVER_BIN_DIR);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_CORES_DIRPATH_ID];
|
||||
AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_CORES_DIR);
|
||||
@ -218,16 +222,16 @@ static void initDirPathArray(void)
|
||||
strcpy(dirPathArray[AFSDIR_CLIENT_VICE_DIRPATH_ID], afsClntDirPath);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_CLIENT_ETC_DIRPATH_ID];
|
||||
AFSDIR_CLIENT_DIRPATH(pathp, AFSDIR_ETC_DIR);
|
||||
AFSDIR_CLIENT_DIRPATH(pathp, AFSDIR_CLIENT_ETC_DIR);
|
||||
#endif /* AFS_NT40_ENV */
|
||||
|
||||
/* server file paths */
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_THISCELL_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_THISCELL_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_THISCELL_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_CELLSERVDB_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_CELLSERVDB_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_CELLSERVDB_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_NOAUTH_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_NOAUTH_FILE);
|
||||
@ -248,7 +252,7 @@ static void initDirPathArray(void)
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_DB_DIR, AFSDIR_KADB_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_NTPD_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BIN_DIR, AFSDIR_NTPD_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_BIN_DIR, AFSDIR_NTPD_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_PRDB_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_DB_DIR, AFSDIR_PRDB_FILE);
|
||||
@ -257,7 +261,7 @@ static void initDirPathArray(void)
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOGS_DIR, AFSDIR_PTLOG_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_KCONF_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_KCONF_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_KCONF_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_VLDB_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_DB_DIR, AFSDIR_VLDB_FILE);
|
||||
@ -272,37 +276,37 @@ static void initDirPathArray(void)
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOGS_DIR, AFSDIR_SLVGLOG_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_SALVAGER_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BIN_DIR, AFSDIR_SALVAGER_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_BIN_DIR, AFSDIR_SALVAGER_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_SLVGLOCK_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_KEY_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_KEY_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_KEY_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_ULIST_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_ULIST_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_ULIST_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOZCONF_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_BOZCONF_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZCONF_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_BOZCONFNEW_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZCONFNEW_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOZLOG_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOGS_DIR, AFSDIR_BOZLOG_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOZINIT_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_BOZINIT_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZINIT_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOSVR_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BIN_DIR, AFSDIR_BOSVR_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSSERVER_DIR, AFSDIR_BOSVR_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOGS_DIR, AFSDIR_VOLSERLOG_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_ROOTVOL_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_ROOTVOL_FILE);
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_ROOTVOL_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_HOSTDUMP_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_HOSTDUMP_FILE);
|
||||
@ -350,17 +354,17 @@ static void initDirPathArray(void)
|
||||
ntClientConfigDirShort, AFSDIR_CELLSERVDB_FILE_NTCLIENT);
|
||||
#else
|
||||
pathp = dirPathArray[AFSDIR_CLIENT_THISCELL_FILEPATH_ID];
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_THISCELL_FILE);
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_THISCELL_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID];
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_CELLSERVDB_FILE);
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_CELLSERVDB_FILE);
|
||||
#endif /* AFS_NT40_ENV */
|
||||
|
||||
pathp = dirPathArray[AFSDIR_CLIENT_NETINFO_FILEPATH_ID];
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_NETINFO_FILE);
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_NETINFO_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_CLIENT_NETRESTRICT_FILEPATH_ID];
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_ETC_DIR, AFSDIR_NETRESTRICT_FILE);
|
||||
AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_NETRESTRICT_FILE);
|
||||
|
||||
initFlag = 1; /* finished dirpath initialization */
|
||||
return;
|
||||
@ -382,6 +386,48 @@ const char *getDirPath(afsdir_id_t string_id)
|
||||
}
|
||||
return (const char *)dirPathArray[string_id];
|
||||
}
|
||||
/*
|
||||
* LocalizePathHead() -- Make path relative to local part
|
||||
*
|
||||
* ConstructLocalPath takes a path and a directory that path should
|
||||
* be considered relative to. This function checks the given path
|
||||
* for a prefix that represents a canonical path. If such a prefix
|
||||
* is found, the path is adjusted to remove the prefix and the path
|
||||
* is considered relative to the local version of that path.
|
||||
*/
|
||||
|
||||
/* The following array maps cannonical parts to local parts. It
|
||||
* might seem reasonable to simply construct an array in parallel to
|
||||
* dirpatharray but it turns out you don't want translations for all
|
||||
local paths.
|
||||
*/
|
||||
|
||||
struct canonmapping {
|
||||
const char * canonical;
|
||||
const char * local;
|
||||
};
|
||||
static struct canonmapping CanonicalTranslations[] = {
|
||||
{AFSDIR_CANONICAL_SERVER_ETC_DIRPATH, AFSDIR_SERVER_ETC_DIR},
|
||||
{ AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH, AFSDIR_LOGS_DIR},
|
||||
{ AFSDIR_CANONICAL_SERVER_LOCAL_DIRPATH, AFSDIR_LOCAL_DIR},
|
||||
{AFSDIR_CANONICAL_SERVER_BIN_DIRPATH, AFSDIR_SERVER_BIN_DIR },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static void LocalizePathHead ( const char **path, const char **relativeTo)
|
||||
{
|
||||
struct canonmapping *current;
|
||||
for (current = CanonicalTranslations; current->local != NULL ; current++) {
|
||||
int canonlength = strlen (current->canonical);
|
||||
if (strncmp (*path, current->canonical, canonlength) == 0 ) {
|
||||
(*path) += canonlength;
|
||||
if (**path == '/')
|
||||
(*path)++;
|
||||
*relativeTo = current->local;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
@ -399,7 +445,7 @@ const char *getDirPath(afsdir_id_t string_id)
|
||||
* 2) If cpath begins with a drive letter but is not fully qualified,
|
||||
* i.e., it is drive relative, then the function fails with EINVAL.
|
||||
* 3) If cpath begins with '/' (or '\') then the path returned is the
|
||||
* concatenation AFS-server-install-dir + cpath.
|
||||
* concatenation AFS-server-install-dir + cpath after translating for localization.
|
||||
* 4) Otherwise the path returned is the concatenation
|
||||
* AFS-server-install-dir + relativeTo + cpath.
|
||||
*
|
||||
@ -430,6 +476,7 @@ ConstructLocalPath(const char *cpath,
|
||||
cpath++;
|
||||
}
|
||||
|
||||
LocalizePathHead (&cpath,&relativeTo);
|
||||
if ((((*cpath >= 'a') && (*cpath <= 'z')) ||
|
||||
((*cpath >= 'A') && (*cpath <= 'Z'))) &&
|
||||
(*(cpath+1) == ':')) {
|
||||
@ -528,6 +575,7 @@ ConstructLocalPath(const char *cpath,
|
||||
cpath++;
|
||||
}
|
||||
|
||||
LocalizePathHead (&cpath, &relativeTo);
|
||||
if (*cpath == '/') {
|
||||
newPath = (char *)malloc(strlen(cpath) + 1);
|
||||
if (!newPath) {
|
||||
|
@ -16,15 +16,20 @@
|
||||
* storing AFS system files (binaries, logs, etc.) in a user-specified
|
||||
* installation directory. This breaks from the traditional notion of
|
||||
* all AFS system files being stored under /usr/afs or /usr/vice.
|
||||
*
|
||||
* The core concept is that there is a dynamically determined installation
|
||||
* In addition, now that OpenAFs supports configure, it is desirable
|
||||
* to support the configure options for manipulating directories and
|
||||
* setting the compilation prefix.
|
||||
* For NT, the core concept is that there is a dynamically determined installation
|
||||
* directory that is the prefix to a well-known AFS tree. The structure
|
||||
* of this well-known AFS tree remains unchanged. For example, AFS server
|
||||
* binaries reside in <install dir>/usr/afs/bin, server configuration files
|
||||
* reside in <install dir>/usr/afs/etc, etcetera. This scheme allows the
|
||||
* flexibility required by NT, without requiring file-location changes
|
||||
* on Unix (for which <install dir> can simply be null).
|
||||
*
|
||||
* flexibility required by NT.
|
||||
* On UNIX, this header file is generated by configure. Directory
|
||||
* paths are substituted in based on options passed to configure.
|
||||
* While the server and client roots are maintained in the dirpath
|
||||
* array, they should never be used by the code as they tend to be
|
||||
* meaningless.
|
||||
* Thus file paths can no longer be hard-coded; rather, all file paths are
|
||||
* specified via the macros provided by this package.
|
||||
*
|
||||
@ -43,10 +48,13 @@
|
||||
*
|
||||
* Conversion functions are provided that translate canonical (wire-format)
|
||||
* paths to fully qualified local paths; see the documentation in dirpath.c
|
||||
* for details. Note that these conversion functions also accomodate fully
|
||||
* qualified paths on the wire, for exceptional cases where this feature
|
||||
* may be required. Again, these conversion functions have been implemented
|
||||
* such that no file-location changes are required on Unix.
|
||||
* for details. Note that these conversion functions also try to
|
||||
* accomodate fully qualified paths on the wire, for exceptional
|
||||
* cases where this feature may be required. Unfortunately there is
|
||||
* no way to distinguish between canonical and fully qualified paths
|
||||
* so if for example /usr/afs/bin is both a valid canonical and local
|
||||
* path and they do not both map to the same place, then the canonical
|
||||
* path is used.
|
||||
*
|
||||
* The path macros provided here are divided into local (AFSDIR_*) and
|
||||
* canonical (AFSDIR_CANONICAL_*). The canonical macros MUST be used by
|
||||
@ -94,15 +102,18 @@ ConstructLocalLogPath(const char *cpath,
|
||||
/* ----------------- Directory/file name macros ------------------ */
|
||||
|
||||
/* afs installation dir names */
|
||||
#define AFSDIR_ETC_DIR "etc"
|
||||
#define AFSDIR_BIN_DIR "bin"
|
||||
#define AFSDIR_SERVER_ETC_DIR "@afsconfdir"
|
||||
#define AFSDIR_CLIENT_ETC_DIR "@viceetcdir"
|
||||
#define AFSDIR_SERVER_BIN_DIR "@afssrvdir"
|
||||
#define AFSDIR_CORES_DIR "cores"
|
||||
#define AFSDIR_DB_DIR "db"
|
||||
#define AFSDIR_LOGS_DIR "logs"
|
||||
#define AFSDIR_LOCAL_DIR "local"
|
||||
#define AFSDIR_BACKUP_DIR "backup"
|
||||
#define AFSDIR_MIGR_DIR "local/migrate"
|
||||
#define AFSDIR_BIN_FILE_DIR "local/migrate/bin_files"
|
||||
#define AFSDIR_DB_DIR "@afsdbdir"
|
||||
#define AFSDIR_LOGS_DIR "@afslogsdir"
|
||||
#define AFSDIR_LOCAL_DIR "@afslocaldir"
|
||||
#define AFSDIR_BACKUP_DIR "@afsbackupdir"
|
||||
#define AFSDIR_MIGR_DIR "@afslocaldir/migrate"
|
||||
#define AFSDIR_BIN_FILE_DIR "@afslocaldir/migrate/bin_files"
|
||||
#define AFSDIR_BOSCONFIG_DIR "@afsbosconfigdir"
|
||||
#define AFSDIR_BOSSERVER_DIR "@afsbosserverdir"
|
||||
|
||||
/* file names */
|
||||
#define AFSDIR_THISCELL_FILE "ThisCell"
|
||||
@ -165,16 +176,16 @@ ConstructLocalLogPath(const char *cpath,
|
||||
#endif
|
||||
|
||||
#define AFSDIR_CANONICAL_SERVER_BIN_DIRPATH \
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_BIN_DIR
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/bin"
|
||||
|
||||
#define AFSDIR_CANONICAL_SERVER_ETC_DIRPATH \
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_ETC_DIR
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/etc"
|
||||
|
||||
#define AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH \
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_LOGS_DIR
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/logs"
|
||||
|
||||
#define AFSDIR_CANONICAL_SERVER_LOCAL_DIRPATH \
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_LOCAL_DIR
|
||||
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/local"
|
||||
|
||||
|
||||
#define AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH \
|
Loading…
Reference in New Issue
Block a user