From 2b8e09315c6f08f3972754b3ea0b6847b1f12d25 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Thu, 10 Dec 2009 11:37:34 -0500 Subject: [PATCH] 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 --- src/JAVA/libjafs/ACL.c | 4 +--- src/WINNT/afsd/fs.c | 5 +---- src/WINNT/afsd/symlink.c | 2 +- src/WINNT/client_exp/gui2fs.cpp | 4 +--- .../client_exp/make_symbolic_link_dlg.cpp | 1 - src/WINNT/client_exp/shell_ext.cpp | 2 +- src/afs/Makefile.in | 6 ++++++ src/afs/NTMakefile | 2 +- src/afs/afs.h | 5 ++--- src/afs/afs_consts.h | 19 +++++++++++++++++++ src/kauth/kkids.c | 2 +- src/kauth/test/test_interim_ktc.c | 2 +- src/sys/rmtsysnet.c | 4 +--- src/update/client.c | 10 +++++----- src/update/global.h | 2 +- src/update/server.c | 4 ++-- src/uss/uss_acl.c | 2 +- src/venus/afsio.c | 2 +- src/venus/fs.c | 8 +++----- src/venus/livesys.c | 2 +- src/venus/twiddle.c | 2 +- src/venus/up.c | 2 +- src/vlserver/cnvldb.c | 1 - src/vlserver/sascnvldb.c | 2 +- 24 files changed, 53 insertions(+), 42 deletions(-) create mode 100644 src/afs/afs_consts.h diff --git a/src/JAVA/libjafs/ACL.c b/src/JAVA/libjafs/ACL.c index 20f055756..11fe67fc9 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 295c1cfff..6cf53e50f 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 758b8a62c..ad8501629 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 0c1402987..9c6b52763 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 376da86da..e35ac78b9 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 bee75fae8..3b7a82d49 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 0841a6c1f..9f4864f3c 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 eee44ca98..4f688d0ca 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 7659983fa..3685d53b3 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 000000000..14e2635a6 --- /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 295ebbd03..10361eff6 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 2c7baad9e..e96d7e67b 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 9faf082c2..097e941c0 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 333e1eb03..74185e623 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 550f95cd5..2606d52ce 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 9b5641c73..67ac54e88 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 65e68b171..8ae9e79c5 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 8d2cd8f78..41e565583 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 96ce3491d..383590e76 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 ef7e7af1b..997879003 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 6b731abf9..af736f0e4 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 1cc7e7338..057d593df 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 8f20dd986..15561daf2 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 4c6bb6da4..b73b6ef56 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"; -- 2.39.5