From 6c6f9dce248bb22162981fec8a5de53736740e7f Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 10 Jul 2009 11:58:44 +0100 Subject: [PATCH] Tidy the vol directory - Remove some further warnings from the vol directory - Add volutil_PartitionName2_r to afsutil_prototypes.h - Export vol_prototypes.h so it can be used elsewhere in the tree Reviewed-on: http://gerrit.openafs.org/17 Reviewed-by: Derrick Brashear Reviewed-by: Russ Allbery Verified-by: Derrick Brashear --- src/util/afsutil_prototypes.h | 1 + src/vol/Makefile.in | 6 +++++- src/vol/clone.c | 1 + src/vol/namei_ops.c | 5 ++--- src/vol/vol_prototypes.h | 28 ++++++++++++++++++++++++++++ src/vol/volume.h | 3 +++ src/vol/vutil.c | 8 ++------ 7 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 src/vol/vol_prototypes.h diff --git a/src/util/afsutil_prototypes.h b/src/util/afsutil_prototypes.h index 3bcbacec3..d4324cad2 100644 --- a/src/util/afsutil_prototypes.h +++ b/src/util/afsutil_prototypes.h @@ -195,6 +195,7 @@ extern int afsUUID_to_string(const afsUUID * uuid, char *str, size_t strsz); /* volparse.c */ extern afs_int32 volutil_GetPartitionID(char *aname); extern char *volutil_PartitionName_r(int avalue, char *tbuffer, int buflen); +extern afs_int32 volutil_PartitionName2_r(afs_int32 part, char *tbuffer, size_t buflen); extern char *volutil_PartitionName(int avalue); extern afs_int32 util_GetInt32(register char *as, afs_int32 * aval); extern afs_uint32 util_GetUInt32(register char *as, afs_uint32 * aval); diff --git a/src/vol/Makefile.in b/src/vol/Makefile.in index 6e0b920fe..501a922d2 100644 --- a/src/vol/Makefile.in +++ b/src/vol/Makefile.in @@ -50,7 +50,8 @@ all: gi \ ${TOP_INCDIR}/afs/salvsync.h \ ${TOP_INCDIR}/afs/daemon_com.h \ ${TOP_INCDIR}/afs/ihandle.h \ - ${TOP_INCDIR}/afs/namei_ops.h + ${TOP_INCDIR}/afs/namei_ops.h \ + ${TOP_INCDIR}/afs/vol_prototypes.h ${TOP_LIBDIR}/vlib.a: vlib.a ${INSTALL_DATA} $? $@ @@ -103,6 +104,9 @@ ${TOP_INCDIR}/afs/salvage.h: salvage.h ${TOP_INCDIR}/afs/vol-salvage.h: vol-salvage.h ${INSTALL_DATA} $? $@ +${TOP_INCDIR}/afs/vol_prototypes.h: vol_prototypes.h + ${INSTALL_DATA} $? $@ + # # Installation targets # diff --git a/src/vol/clone.c b/src/vol/clone.c index fe1704ae3..b848a7753 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -51,6 +51,7 @@ #include "volume.h" #include "partition.h" #include "viceinode.h" +#include "vol_prototypes.h" /*@printflike@*/ extern void Log(const char *format, ...); diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index 46efbdd1e..3c142d3d2 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -98,7 +98,6 @@ emul_flock(int fd, int cmd) #define flock(f,c) emul_flock(f,c) #endif -extern char *volutil_PartitionName_r(int volid, char *buf, int buflen); int Testing=0; @@ -831,8 +830,8 @@ namei_copy_on_write(IHandle_t *h) fdP = IH_OPEN(h); if (!fdP) return EIO; - strcpy(&path, name.n_path); - strcat(&path, "-tmp"); + strcpy(path, name.n_path); + strcat(path, "-tmp"); fd = afs_open(path, O_CREAT | O_EXCL | O_TRUNC | O_RDWR, 0); if (fd < 0) { FDH_CLOSE(fdP); diff --git a/src/vol/vol_prototypes.h b/src/vol/vol_prototypes.h new file mode 100644 index 000000000..1be7407c5 --- /dev/null +++ b/src/vol/vol_prototypes.h @@ -0,0 +1,28 @@ +/* + * 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 _VOL_PROTOTYPES_H +#define _VOL_PROTOTYPES_h + +/* clone.c */ +extern void CloneVolume(Error *, Volume *, Volume *, Volume *); +extern int (*vol_PollProc) (void); + +/* nuke.c */ +extern int nuke(char *, afs_int32); + +/* vutil.c */ +extern void AssignVolumeName(register VolumeDiskData * vol, char *name, char *ext); +extern void AssignVolumeName_r(register VolumeDiskData * vol, char *name, char *ext); +extern void ClearVolumeStats(register VolumeDiskData * vol); +extern void ClearVolumeStats_r(register VolumeDiskData * vol); +extern afs_int32 CopyVolumeHeader(VolumeDiskData *, VolumeDiskData *); + +#endif + diff --git a/src/vol/volume.h b/src/vol/volume.h index 51824d31f..082a4a3e0 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -783,6 +783,7 @@ extern int VInitVolumePackage(ProgramType pt, afs_uint32 nLargeVnodes, afs_uint32 nSmallVnodes, int connect, afs_uint32 volcache); extern void DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh); extern void VolumeHeaderToDisk(VolumeDiskHeader_t * dh, VolumeHeader_t * h); +extern void AssignVolumeName(VolumeDiskData * vol, char *name, char *ext); extern void VTakeOffline_r(register Volume * vp); extern void VTakeOffline(register Volume * vp); extern Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint); @@ -818,6 +819,8 @@ extern void VCancelReservation_r(Volume * vp); extern int VVolOpLeaveOnline_r(Volume * vp, FSSYNC_VolOp_info * vopinfo); extern int VVolOpSetVBusy_r(Volume * vp, FSSYNC_VolOp_info * vopinfo); +extern void VPurgeVolume(Error * ec, Volume * vp); + /* Naive formula relating number of file size to number of 1K blocks in file */ /* Note: we charge 1 block for 0 length files so the user can't store diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 298160665..259aabff8 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -55,6 +55,8 @@ #include "viceinode.h" #include "volinodes.h" +#include "vol_prototypes.h" + #ifdef AFS_AIX_ENV #include #endif @@ -72,12 +74,6 @@ /*@printflike@*/ extern void Log(const char *format, ...); -void AssignVolumeName(register VolumeDiskData * vol, char *name, char *ext); -void AssignVolumeName_r(register VolumeDiskData * vol, char *name, char *ext); -void ClearVolumeStats(register VolumeDiskData * vol); -void ClearVolumeStats_r(register VolumeDiskData * vol); - - #define nFILES (sizeof (stuff)/sizeof(struct stuff)) /* Note: the volume creation functions herein leave the destroyMe flag in the -- 2.39.5