From: Michael Meffie Date: Thu, 10 Dec 2009 16:37:34 +0000 (-0500) Subject: Consolidate duplicate definitions X-Git-Tag: openafs-devel-1_5_69~90 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=2b8e09315c6f08f3972754b3ea0b6847b1f12d25 Consolidate duplicate definitions Housekeeping change to consolidate some common definitions. Create a new common header called afs_consts.h. This allows us to remove the afscp.c dependency on afs.h (so src/tests will build again.) Rename the max filename definition in the update server package to MAXFNSIZE to avoid a name conflict with MAXSIZE. The global defines will be prefixed with AFS_ in a second patch. Change-Id: I2b8d555a244cc92d889618de4eec4a99550d7c7f Reviewed-on: http://gerrit.openafs.org/855 Reviewed-by: Mickey Lane Tested-by: Mickey Lane Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/JAVA/libjafs/ACL.c b/src/JAVA/libjafs/ACL.c index 20f0557..11fe67f 100644 --- a/src/JAVA/libjafs/ACL.c +++ b/src/JAVA/libjafs/ACL.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "GetNativeString.h" @@ -40,10 +41,7 @@ */ /* just for debugging */ -#define MAXHOSTS 13 -#define OMAXHOSTS 8 #define MAXNAME 100 -#define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ #define VMSGSIZE 128 /* size of msg buf in volume hdr */ diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index 295c1cf..6cf53e5 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -36,11 +37,7 @@ #include "afsd.h" #include "cm_ioctl.h" -#define MAXHOSTS 13 -#define OMAXHOSTS 8 -#define MAXCELLHOSTS 8 #define MAXNAME 100 -#define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ #define VMSGSIZE 128 /* size of msg buf in volume hdr */ #define CELL_MAXNAMELEN 256 diff --git a/src/WINNT/afsd/symlink.c b/src/WINNT/afsd/symlink.c index 758b8a6..ad85016 100644 --- a/src/WINNT/afsd/symlink.c +++ b/src/WINNT/afsd/symlink.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,6 @@ #include "cmd.h" #define MAXNAME 100 -#define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ static char space[MAXSIZE]; diff --git a/src/WINNT/client_exp/gui2fs.cpp b/src/WINNT/client_exp/gui2fs.cpp index 0c14029..9c6b527 100644 --- a/src/WINNT/client_exp/gui2fs.cpp +++ b/src/WINNT/client_exp/gui2fs.cpp @@ -33,6 +33,7 @@ extern "C" { #include "fs.h" #include "fs_utils.h" #include +#include #include #include #include @@ -52,10 +53,7 @@ extern "C" { #define PCCHAR(str) ((char *)(const char *)(str)) #define VL_NOENT (363524L) -#define MAXHOSTS 13 -#define OMAXHOSTS 8 #define MAXNAME 100 -#define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ #define VMSGSIZE 128 /* size of msg buf in volume hdr */ diff --git a/src/WINNT/client_exp/make_symbolic_link_dlg.cpp b/src/WINNT/client_exp/make_symbolic_link_dlg.cpp index 376da86..e35ac78 100644 --- a/src/WINNT/client_exp/make_symbolic_link_dlg.cpp +++ b/src/WINNT/client_exp/make_symbolic_link_dlg.cpp @@ -20,7 +20,6 @@ extern "C" { #include "make_symbolic_link_dlg.h" #include "gui2fs.h" #include "msgs.h" -#define MAXSIZE 2048 /* most I'll get back from PIOCTL */ #ifdef _DEBUG #define new DEBUG_NEW diff --git a/src/WINNT/client_exp/shell_ext.cpp b/src/WINNT/client_exp/shell_ext.cpp index bee75fa..3b7a82d 100644 --- a/src/WINNT/client_exp/shell_ext.cpp +++ b/src/WINNT/client_exp/shell_ext.cpp @@ -15,6 +15,7 @@ extern "C" { #include #include +#include } #include @@ -46,7 +47,6 @@ ULONG nICRefCount=0; ULONG nTPRefCount=0; ULONG nXPRefCount=0; -#define MAXSIZE 2048 /* most I'll get back from PIOCTL */ #define PCCHAR(str) ((char *)(const char *)str) static char space[MAXSIZE]; diff --git a/src/afs/Makefile.in b/src/afs/Makefile.in index 0841a6c..9f4864f 100644 --- a/src/afs/Makefile.in +++ b/src/afs/Makefile.in @@ -41,6 +41,7 @@ afszcm.cat: afs_trace.msf esac depinstall: afszcm.cat AFS_component_version_number.c \ + ${TOP_INCDIR}/afs/afs_consts.h \ ${TOP_INCDIR}/afs/afs.h \ ${TOP_INCDIR}/afs/osi_inode.h \ ${TOP_INCDIR}/afs/afs_stats.h \ @@ -49,6 +50,9 @@ depinstall: afszcm.cat AFS_component_version_number.c \ ${TOP_INCDIR}/afs/unified_afs.h \ ${TOP_INCDIR}/afs/sysctl.h +${TOP_INCDIR}/afs/afs_consts.h: afs_consts.h + ${INSTALL_DATA} $? $@ + ${TOP_INCDIR}/afs/afs.h: afs.h ${INSTALL_DATA} $? $@ @@ -73,6 +77,7 @@ ${TOP_INCDIR}/afs/unified_afs.h: unified_afs.h install: unified_afs.h ${INSTALL} -d ${DESTDIR}${includedir}/afs ${INSTALL_DATA} afs.h ${DESTDIR}${includedir}/afs/afs.h + ${INSTALL_DATA} afs_consts.h ${DESTDIR}${includedir}/afs/afs_consts.h ${INSTALL_DATA} afs_stats.h ${DESTDIR}${includedir}/afs/afs_stats.h ${INSTALL_DATA} exporter.h ${DESTDIR}${includedir}/afs/exporter.h ${INSTALL_DATA} nfsclient.h ${DESTDIR}${includedir}/afs/nfsclient.h @@ -98,6 +103,7 @@ install: unified_afs.h dest: unified_afs.h ${INSTALL} -d ${DEST}/include/afs ${INSTALL_DATA} afs.h ${DEST}/include/afs/afs.h + ${INSTALL_DATA} afs_consts.h ${DEST}/include/afs/afs_consts.h ${INSTALL_DATA} afs_stats.h ${DEST}/include/afs/afs_stats.h ${INSTALL_DATA} exporter.h ${DEST}/include/afs/exporter.h ${INSTALL_DATA} nfsclient.h ${DEST}/include/afs/nfsclient.h diff --git a/src/afs/NTMakefile b/src/afs/NTMakefile index eee44ca..4f688d0 100644 --- a/src/afs/NTMakefile +++ b/src/afs/NTMakefile @@ -19,5 +19,5 @@ $(INCDIR)\afs\unified_afs.c $(INCDIR)\afs\unified_afs.h: unified_afs.et unifi $(COMPILE_ET) unified_afs -h unified_afs $(COPY) unified_afs.h $(DESTDIR)\include\afs -install: $(INCDIR)\afs\unified_afs.c $(INCDIR)\afs\afs_stats.h +install: $(INCDIR)\afs\unified_afs.c $(INCDIR)\afs\afs_stats.h $(INCDIR)\afs\afs_consts.h diff --git a/src/afs/afs.h b/src/afs/afs.h index 7659983..3685d53 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -14,8 +14,10 @@ */ #ifdef KDUMP_KERNEL #include +#include #else #include "afs/afs_args.h" +#include "afs/afs_consts.h" #endif /* @@ -69,9 +71,6 @@ extern int afs_shuttingdown; /* The basic defines for the Andrew file system better keep things powers of two so "& (foo-1)" hack works for masking bits */ -#define MAXHOSTS 13 /* max hosts per single volume */ -#define OMAXHOSTS 8 /* backwards compatibility */ -#define MAXCELLHOSTS 8 /* max vldb servers per cell */ #define NBRS 15 /* max number of queued daemon requests */ #define NUSERS 16 /* hash table size for unixuser table */ #define NSERVERS 16 /* hash table size for server table */ diff --git a/src/afs/afs_consts.h b/src/afs/afs_consts.h new file mode 100644 index 0000000..14e2635 --- /dev/null +++ b/src/afs/afs_consts.h @@ -0,0 +1,19 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef _AFS_CONSTS_H_ +#define _AFS_CONSTS_H_ + +#define MAXHOSTS 13 /* max hosts per single volume */ +#define OMAXHOSTS 8 /* backwards compatibility */ +#define MAXCELLHOSTS 8 /* max vldb servers per cell */ + +#define MAXSIZE 2048 /* max returned from PIOCTL */ + +#endif /* _AFS_CONSTS_H_ */ diff --git a/src/kauth/kkids.c b/src/kauth/kkids.c index 295ebbd..10361ef 100644 --- a/src/kauth/kkids.c +++ b/src/kauth/kkids.c @@ -35,11 +35,11 @@ #include #include #include +#include #include "kkids.h" #define MAXNAME 100 -#define MAXSIZE 2048 static int using_child = 0; static FILE *childin, *childout; /* file pointers on pipe to kpwvalid */ diff --git a/src/kauth/test/test_interim_ktc.c b/src/kauth/test/test_interim_ktc.c index 2c7baad..e96d7e6 100644 --- a/src/kauth/test/test_interim_ktc.c +++ b/src/kauth/test/test_interim_ktc.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "kautils.h" @@ -296,7 +297,6 @@ CheckAuth2(server) /* Stolen from the "fs" command. */ #define MAXNAME 100 -#define MAXSIZE 2048 static void ListCellsCmd() diff --git a/src/sys/rmtsysnet.c b/src/sys/rmtsysnet.c index 9faf082..097e941 100644 --- a/src/sys/rmtsysnet.c +++ b/src/sys/rmtsysnet.c @@ -9,7 +9,7 @@ #include #include - +#include #include #include @@ -38,8 +38,6 @@ */ #define MAXNAME 100 -#define MAXSIZE 2048 -#define MAXHOSTS 8 /* XXX HARD Limit limitation XXX */ #define MAXGCSIZE 16 struct Acl { diff --git a/src/update/client.c b/src/update/client.c index 333e1eb..74185e6 100644 --- a/src/update/client.c +++ b/src/update/client.c @@ -111,7 +111,7 @@ main(int argc, char **argv) afs_uint32 mode; int error; - char hostname[MAXSIZE]; + char hostname[MAXFNSIZE]; FILE *stream; afs_int32 time, length, atime; struct filestr *df; @@ -122,7 +122,7 @@ main(int argc, char **argv) int a, cnt; rxkad_level level; - char dirbuf[MAXSIZE], filename[MAXSIZE]; + char dirbuf[MAXFNSIZE], filename[MAXFNSIZE]; struct filestr *dirname, *ModFiles, *okhostfiles; #ifdef AFS_AIX32_ENV /* @@ -347,7 +347,7 @@ main(int argc, char **argv) { /*delete all the redundant files on the client */ DIR *dirp; struct dirent *dp; - char filename[MAXSIZE]; + char filename[MAXFNSIZE]; dirp = opendir(curDir); if (dirp == 0) { @@ -602,7 +602,7 @@ NotOnHost(char *filename, struct filestr *okhostfiles) static int RenameNewFiles(struct filestr *modFiles) { - char newname[MAXSIZE]; + char newname[MAXFNSIZE]; char *fname; int errcode = 0; struct filestr *tf; @@ -656,7 +656,7 @@ GetFileFromUpServer(struct rx_connection *conn, /* handle for upserver */ #else struct timeval tvp[2]; #endif - char newfile[MAXSIZE]; + char newfile[MAXFNSIZE]; /* construct local path from canonical (wire-format) path */ errcode = ConstructLocalPath(filename, "/", &lfile); diff --git a/src/update/global.h b/src/update/global.h index 550f95c..2606d52 100644 --- a/src/update/global.h +++ b/src/update/global.h @@ -15,7 +15,7 @@ #endif #define TIMEOUT 300 /*interval after which the files are resynch'ed */ -#define MAXSIZE 1024 /*max size of filenames */ +#define MAXFNSIZE 1024 /*max size of filenames */ #define MAXENTRIES 20 #define UPDATEERR 100 diff --git a/src/update/server.c b/src/update/server.c index 9b5641c..67ac54e 100644 --- a/src/update/server.c +++ b/src/update/server.c @@ -465,7 +465,7 @@ update_SendDirInfo(char *name, /* Name of dir to enumerate */ struct dirent *dp; FILE *stream; struct stat tstatus; - char filename[MAXSIZE], dirInfoFile[MAXSIZE]; + char filename[MAXFNSIZE], dirInfoFile[MAXFNSIZE]; int fd, tfd, errcode, error, err; error = 0; @@ -487,7 +487,7 @@ update_SendDirInfo(char *name, /* Name of dir to enumerate */ goto fail; } if ((tstatus.st_mode & S_IFMT) != S_IFDIR) { /* not a directory */ - char dirEntry[MAXSIZE]; + char dirEntry[MAXFNSIZE]; strcpy(dirEntry, origDir); strcat(dirEntry, "/"); diff --git a/src/uss/uss_acl.c b/src/uss/uss_acl.c index 65e68b1..8ae9e79 100644 --- a/src/uss/uss_acl.c +++ b/src/uss/uss_acl.c @@ -35,9 +35,9 @@ #include #include #include +#include #define MAXNAME 100 -#define MAXSIZE 2048 #undef USS_ACL_DB diff --git a/src/venus/afsio.c b/src/venus/afsio.c index 8d2cd8f..41e5655 100644 --- a/src/venus/afsio.c +++ b/src/venus/afsio.c @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include @@ -99,7 +100,6 @@ #include #include #include "../rxkad/md5.h" -#define MAXHOSTS 13 #ifdef O_LARGEFILE #define afs_stat stat64 #define afs_fstat fstat64 diff --git a/src/venus/fs.c b/src/venus/fs.c index 96ce349..383590e 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -11,6 +11,7 @@ #include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #ifdef AFS_AIX32_ENV #include #endif @@ -50,12 +52,8 @@ #include #include #include - -#define MAXHOSTS 13 -#define OMAXHOSTS 8 -#define MAXCELLHOSTS 8 + #define MAXNAME 100 -#define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ #define VMSGSIZE 128 /* size of msg buf in volume hdr */ diff --git a/src/venus/livesys.c b/src/venus/livesys.c index ef7e7af..9978790 100644 --- a/src/venus/livesys.c +++ b/src/venus/livesys.c @@ -26,12 +26,12 @@ #include #include #include +#include #include #ifdef AFS_AIX32_ENV #include #endif -#define MAXSIZE 2048 static char space[MAXSIZE]; int diff --git a/src/venus/twiddle.c b/src/venus/twiddle.c index 6b731ab..af736f0 100644 --- a/src/venus/twiddle.c +++ b/src/venus/twiddle.c @@ -35,8 +35,8 @@ #include #include #include +#include -#define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ #define VMSGSIZE 128 /* size of msg buf in volume hdr */ diff --git a/src/venus/up.c b/src/venus/up.c index 1cc7e73..057d593 100644 --- a/src/venus/up.c +++ b/src/venus/up.c @@ -47,6 +47,7 @@ #include #include #include +#include /* ************************************************************* */ @@ -64,7 +65,6 @@ short setacl = 1; short oldAcl = 0; char file1[MAXPATHLEN], file2[MAXPATHLEN]; -#define MAXSIZE 2048 static char space[MAXSIZE]; struct OldAcl { diff --git a/src/vlserver/cnvldb.c b/src/vlserver/cnvldb.c index 8f20dd9..15561da 100644 --- a/src/vlserver/cnvldb.c +++ b/src/vlserver/cnvldb.c @@ -27,7 +27,6 @@ #include "vlserver.h" #include "cnvldb.h" /* CHANGEME! */ -#define MAXSIZE 2048 /* most I'll get back from PIOCTL */ #define BADSERVERID 255 /* XXX */ diff --git a/src/vlserver/sascnvldb.c b/src/vlserver/sascnvldb.c index 4c6bb6d..b73b6ef 100644 --- a/src/vlserver/sascnvldb.c +++ b/src/vlserver/sascnvldb.c @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef notdef #include @@ -32,7 +33,6 @@ #endif #include -#define MAXSIZE 2048 /* most I'll get back from PIOCTL */ static char pn[] = "cnvldb";