From 37eea339f0a45bcc932262957c5676a42eb51d56 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 10 Dec 2018 22:04:32 +0000 Subject: [PATCH] Change config to /etc/kafs/client.{conf,d} Change the name of the config file and dir to /etc/kafs/client.{conf,d} rather than /etc/kafs/cellservdb.*. Note that the default cellservdb.conf is unrenamed and is included by client.conf. Signed-off-by: David Howells --- Makefile | 11 ++++++----- conf/etc.conf | 6 +++--- redhat/kafs-client.spec | 9 ++++----- src/dns_main.c | 2 +- src/include/kafs/cellserv.h | 6 +++--- src/kafs-check-config.c | 4 ++-- src/lib_cell_lookup.c | 18 +++++++++--------- src/preload-cells.c | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 3f9b55c..9c6a897 100644 --- a/Makefile +++ b/Makefile @@ -56,11 +56,11 @@ install: all $(INSTALL) -D -m 0644 man/aklog-kafs.1 $(DESTDIR)$(MAN1)/aklog-kafs.1 $(INSTALL) -D -m 0644 man/aklog.1 $(DESTDIR)$(MAN1)/aklog.1 $(INSTALL) -D -m 0644 conf/cellservdb.conf $(DESTDIR)$(DATADIR)/cellservdb.conf - $(INSTALL) -D -m 0644 conf/etc.conf $(DESTDIR)$(ETCDIR)/kafs/cellservdb.conf + $(INSTALL) -D -m 0644 conf/etc.conf $(DESTDIR)$(ETCDIR)/kafs/client.conf $(INSTALL) -D -m 0644 conf/kafs_dns.conf $(DESTDIR)$(ETCDIR)/request-key.d/kafs_dns.conf $(INSTALL) -D -m 0644 conf/kafs-config.service $(DESTDIR)$(UNITDIR)/kafs-config.service $(INSTALL) -D -m 0644 conf/afs.mount $(DESTDIR)$(UNITDIR)/afs.mount - $(MKDIR) -m755 $(DESTDIR)$(ETCDIR)/kafs/cellservdb.d + $(MKDIR) -m755 $(DESTDIR)$(ETCDIR)/kafs/client.d $(MKDIR) -m755 $(DESTDIR)/afs ############################################################################### @@ -97,9 +97,10 @@ ZSRCBALL := rpmbuild/SOURCES/$(ZTARBALL) BUILDID := .local dist := $(word 2,$(shell grep -r "^%dist" /etc/rpm /usr/lib/rpm)) -release := $(word 2,$(shell grep ^Release: $(SPECFILE))) -release := $(subst %{?dist},$(dist),$(release)) -release := $(subst %{?buildid},$(BUILDID),$(release)) +release3:= $(word 2,$(shell grep ^Release: $(SPECFILE))) +release2:= $(subst %{?dist},$(dist),$(release3)) +release1:= $(subst %{?buildid},$(BUILDID),$(release2)) +release := $(subst %{?distprefix},,$(release1)) rpmver := $(VERSION)-$(release) SRPM := rpmbuild/SRPMS/kafs-client-$(rpmver).src.rpm diff --git a/conf/etc.conf b/conf/etc.conf index 11e144a..d0ebfa5 100644 --- a/conf/etc.conf +++ b/conf/etc.conf @@ -1,6 +1,6 @@ # -# This file stitches together the local kAFS cell database, which can be -# placed in the cellservdb.d/ directory, with the generic database. +# This file stitches together the local kAFS configuration and cell database, +# which can be placed in the client.d/ directory, with the generic database. # -includedir /etc/kafs/cellservdb.d +includedir /etc/kafs/client.d include /usr/share/kafs/cellservdb.conf diff --git a/redhat/kafs-client.spec b/redhat/kafs-client.spec index 79aec9f..083a335 100644 --- a/redhat/kafs-client.spec +++ b/redhat/kafs-client.spec @@ -15,9 +15,8 @@ BuildRequires: keyutils-libs-devel BuildRequires: openssl-devel # -# Need this for the upcall program to do DNS lookups. v1.5.11 can read the -# kAFS config files: -# /etc/kafs/cellservdb.conf +# Need this for the upcall program to do DNS lookups. +# /etc/kafs/client.conf # %global datadir %{_datarootdir}/kafs @@ -129,8 +128,8 @@ ln -s aklog-kafs %{buildroot}/%{_bindir}/aklog %{_libdir}/libkafs_client.so.%{libapiversion} %{_libdir}/libkafs_client.so.%{libapivermajor} %{datadir} -%config(noreplace) %{_sysconfdir}/kafs/cellservdb.conf -%config(noreplace) %{_sysconfdir}/kafs/cellservdb.d +%config(noreplace) %{_sysconfdir}/kafs/client.conf +%config(noreplace) %{_sysconfdir}/kafs/client.d %files libs-devel %{_libdir}/libkafs_client.so diff --git a/src/dns_main.c b/src/dns_main.c index 0580d3a..2c1e5a3 100644 --- a/src/dns_main.c +++ b/src/dns_main.c @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) if (kafs_init_lookup_context(&ctx) < 0) exit(1); - if (kafs_init_celldb(filep, &ctx.report) < 0) + if (kafs_read_config(filep, &ctx.report) < 0) exit(ctx.report.bad_config ? 3 : 1); /* Generate the payload */ diff --git a/src/include/kafs/cellserv.h b/src/include/kafs/cellserv.h index c48acf0..eec8379 100644 --- a/src/include/kafs/cellserv.h +++ b/src/include/kafs/cellserv.h @@ -1,5 +1,5 @@ /* - * Cell server database parser. + * kAFS config and cell database parser. * * Copyright (C) David Howells (dhowells@redhat.com) 2018 * @@ -144,9 +144,9 @@ extern int kafs_dns_lookup_vlservers(struct kafs_server_list *vsl, /* * cell_lookup.c */ +extern struct kafs_profile kafs_config_profile; extern struct kafs_cell_db *kafs_cellserv_db; -extern struct kafs_profile kafs_cellserv_profile; -extern int kafs_init_celldb(const char *const *files, +extern int kafs_read_config(const char *const *files, struct kafs_report *report); extern struct kafs_cell *kafs_lookup_cell(const char *cell_name, struct kafs_lookup_context *ctx); diff --git a/src/kafs-check-config.c b/src/kafs-check-config.c index ddb5a70..6703db5 100644 --- a/src/kafs-check-config.c +++ b/src/kafs-check-config.c @@ -132,11 +132,11 @@ int main(int argc, char *argv[]) if (kafs_init_lookup_context(&ctx) < 0) exit(1); - if (kafs_init_celldb(filep, &ctx.report) < 0) + if (kafs_read_config(filep, &ctx.report) < 0) exit(ctx.report.bad_config ? 3 : 1); if (dump_profile) - kafs_profile_dump(&kafs_cellserv_profile, 0); + kafs_profile_dump(&kafs_config_profile, 0); if (dump_db) kafs_cellserv_dump(kafs_cellserv_db); diff --git a/src/lib_cell_lookup.c b/src/lib_cell_lookup.c index 6240bb6..65a9a4b 100644 --- a/src/lib_cell_lookup.c +++ b/src/lib_cell_lookup.c @@ -16,13 +16,13 @@ #include #include -static const char *const kafs_std_cellservdb[] = { - ETCDIR "/kafs/cellservdb.conf", +static const char *const kafs_std_config[] = { + ETCDIR "/kafs/client.conf", NULL }; +struct kafs_profile kafs_config_profile = { .name = "" }; struct kafs_cell_db *kafs_cellserv_db; -struct kafs_profile kafs_cellserv_profile = { .name = "" }; #define verbose(r, fmt, ...) \ do { \ @@ -54,19 +54,19 @@ error: } /* - * Initialise the cell database. + * Read the configuration and initialise the cell database. */ -int kafs_init_celldb(const char *const *files, struct kafs_report *report) +int kafs_read_config(const char *const *files, struct kafs_report *report) { if (!files) - files = kafs_std_cellservdb; + files = kafs_std_config; for (; *files; files++) - if (kafs_profile_parse_file(&kafs_cellserv_profile, *files, report) == -1) + if (kafs_profile_parse_file(&kafs_config_profile, *files, report) == -1) return -1; - kafs_cellserv_db = kafs_cellserv_parse_conf(&kafs_cellserv_profile, report); + kafs_cellserv_db = kafs_cellserv_parse_conf(&kafs_config_profile, report); if (!kafs_cellserv_db) return -1; @@ -130,7 +130,7 @@ struct kafs_cell *kafs_lookup_cell(const char *cell_name, struct kafs_cell *cell; unsigned int i, j; - if (!kafs_cellserv_db && kafs_init_celldb(NULL, &ctx->report) < 0) + if (!kafs_cellserv_db && kafs_read_config(NULL, &ctx->report) < 0) return NULL; cell = kafs_alloc_cell(cell_name, ctx); diff --git a/src/preload-cells.c b/src/preload-cells.c index 4199f60..ab308e3 100644 --- a/src/preload-cells.c +++ b/src/preload-cells.c @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) if (argc > 0) files = (const char **)argv; - if (kafs_init_celldb(files, &report) < 0) + if (kafs_read_config(files, &report) < 0) exit(3); do_preload(kafs_cellserv_db, redirect_to_stdout); -- 2.50.1