[OpenAFS-devel] Extension for config

Jeff Mahoney jeffm@suse.com
Wed, 28 Jul 2004 17:57:07 -0400


This is a multi-part message in MIME format.
--------------010609020709000608020509
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hey all -

I'm trying to use OpenAFS 1.3.65 on Linux 2.6 on various platforms that
have yet to be added to the configuration system.

In the long term, I'd like to develop the configuration system to
something more unified. I understand how the existing configuration
system has its advantages for cross os/arch compatibility, but for OSes
like NetBSD or Linux, which support many architectures with relative
equivalence, it seems like a maintenance nightmare.

As a starting point, rather than hack in every new arch I'd like to use
with the Linux 2.6 kernel into src/libafs/MakefileProto.LINUX.in, I
chose to extend src/config/config.c to understand the OS and processor
portions of the sysname separately as tags.

As such, things like ...
<i386_linux26 ppc_linux26 ppc64_linux26 amd64_linux26 ia64_linux26>
some rules
<all -i386_linux26 -ppc_linux26 -ppc64_linux26 -amd64_linux26 -ia64_linux26>
some other rules

... would become ...
<linux26>
some rules
<all -linux26>
some other rules

Of course, the existing tags would still work without changes.

The attached patch includes the changes for src/config/config.c and
appropriate changes for linux26 in src/libafs/MakefileProto.LINUX.in

- -Jeff

- --
Jeff Mahoney
SuSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBCCEzLPWxlyuTD7IRAsxeAJ9lEDj+eYQi7M2U8Kx7wJEqzbiFEgCdFFsm
ZtZgiQ7EQxBI+z/YGtfBkzk=
=OPob
-----END PGP SIGNATURE-----

--------------010609020709000608020509
Content-Type: text/plain;
 name="openafs-1.3.65-config.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="openafs-1.3.65-config.diff"

diff -ruNp openafs-1.3.65/src/config/config.c openafs-1.3.65.devel/src/config/config.c
--- openafs-1.3.65/src/config/config.c	2003-07-15 19:14:55.000000000 -0400
+++ openafs-1.3.65.devel/src/config/config.c	2004-07-27 17:28:19.968766632 -0400
@@ -12,6 +12,7 @@
 #include <sys/file.h>
 #include <sys/time.h>
 #include <stdio.h>
+#include <string.h>
 #include <errno.h>
 
 #include "AFS_component_version_number.c"
@@ -24,8 +25,9 @@ main(int argc, char **argv)
 {
     register FILE *infile;
     register FILE *outfile;
-    char *alist[3];
+    char *alist[5];
     register int code;
+    char *sysname;
 
     if (argc != 4) {
 	printf
@@ -42,9 +44,20 @@ main(int argc, char **argv)
 	printf("config: output file %s not found.\n", argv[2]);
 	exit(1);
     }
+    memset (alist, 0, sizeof (alist));
     alist[0] = argv[3];
     alist[1] = "all";
-    alist[2] = NULL;
+
+    /* This allows JUST arch or JUST OS/version,
+     * Linux 2.6 uses the in-kernel build system, so 
+     * just 'linux26' is enough. */
+    sysname = strdup (alist[0]);
+    alist[2] = strchr (sysname, '_');
+    if (alist[2]) {
+        alist[3] = sysname;
+        *alist[2] = 0;
+        alist[2]++;
+    }
     code = mc_copy(infile, outfile, alist);
     if (code) {
 	printf("config: failed to correctly write makefile '%s', code %d\n",
diff -ruNp openafs-1.3.65/src/libafs/MakefileProto.LINUX.in openafs-1.3.65.devel/src/libafs/MakefileProto.LINUX.in
--- openafs-1.3.65/src/libafs/MakefileProto.LINUX.in	2004-06-07 15:54:33.000000000 -0400
+++ openafs-1.3.65.devel/src/libafs/MakefileProto.LINUX.in	2004-07-27 17:28:19.973765872 -0400
@@ -35,7 +35,7 @@ COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_
 LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
 
 # System specific build commands and flags
-<i386_linux26>
+<linux26>
 # All the platform-specific and kernel-related things are provided by
 # the kernel build system.  So we should _not_ use COMMON_KERN_CFLAGS!
 CCFLAGS = -Wno-strict-prototypes
@@ -104,9 +104,9 @@ DESTDIRS=linux_destdirs
 
 include Makefile.common
 
-<i386_linux26>
+<linux26>
 LINUX_MODULE_EXT=ko
-<all -i386_linux26>
+<all -linux26>
 LINUX_MODULE_EXT=o
 <all>
 
@@ -229,7 +229,7 @@ libafs.ep: $(LIBAFS_EP)
 libafs.bm: $(LIBAFS_BM)
 	echo BM Build Complete
 
-<i386_linux26>
+<linux26>
 ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: libafs.ko
 	cp libafs.ko $@
 
@@ -239,7 +239,7 @@ libafs.ko: .FORCE
 	  @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
 	$(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
         
-<all -i386_linux26>
+<all -linux26>
 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
 	$(RM) -f $@
 	$(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)


--------------010609020709000608020509--