#include "partition.h"
#include "viceinode.h"
#include "vol_prototypes.h"
-
-/*@printflike@*/ extern void Log(const char *format, ...);
+#include "common.h"
int (*vol_PollProc) (void) = 0; /* someone must init this */
} else if (rwinode) {
if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) ==
-1) {
- Log("IH_INC failed: %x, %s, %u errno %d\n",
+ Log("IH_INC failed: %"AFS_PTR_FMT", %s, %u errno %d\n",
V_linkHandle(rwvp), PrintInode(NULL, rwinode),
V_parentId(rwvp), errno);
VForceOffline(rwvp);
if (inodeinced) {
if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) ==
-1) {
- Log("IH_DEC failed: %x, %s, %u errno %d\n",
+ Log("IH_DEC failed: %"AFS_PTR_FMT", %s, %u errno %d\n",
V_linkHandle(rwvp), PrintInode(NULL, rwinode),
V_parentId(rwvp), errno);
VForceOffline(rwvp);
#include <afs/afsutil.h>
+#include "common.h"
+
int Statistics = 0;
/*@printflike@*/ void
--- /dev/null
+#ifndef AFS_SRC_VOL_COMMON_H
+#define AFS_SRC_VOL_COMMON_H
+
+/* common.c */
+extern void Log(const char *format, ...)
+ AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
+extern void Abort(const char *format, ...)
+ AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2)
+ AFS_NORETURN;
+extern void Quit(const char *format, ...)
+ AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2)
+ AFS_NORETURN;
+
+#endif
#include "vnode.h"
#include "volume.h"
#include "partition.h"
+#include "common.h"
#include <rx/rx_queue.h>
#ifdef USE_UNIX_SOCKETS
#include <sys/un.h>
#endif
-/*@printflike@*/ extern void Log(const char *format, ...);
-
int (*V_BreakVolumeCallbacks) (VolumeId);
#define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that
#include "vnode.h"
#include "volume.h"
#include "partition.h"
+#include "common.h"
#ifdef FSSYNC_BUILD_CLIENT
-/*@printflike@*/ extern void Log(const char *format, ...);
-
extern int LogLevel;
static SYNC_client_state fssync_state =
#include "volume_inline.h"
#include "partition.h"
#include "vg_cache.h"
+#include "common.h"
#ifdef HAVE_POLL
#include <sys/poll.h>
#ifdef FSSYNC_BUILD_SERVER
-/*@printflike@*/ extern void Log(const char *format, ...);
-
int (*V_BreakVolumeCallbacks) (VolumeId volume);
#define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that
#include "partition.h"
#include "fssync.h"
#include "volume_inline.h"
+#include "common.h"
#include <afs/errors.h>
/*@+fcnmacros +macrofcndecl@*/
#endif /* !O_LARGEFILE */
/*@=fcnmacros =macrofcndecl@*/
-/*@printflike@*/ extern void Log(const char *format, ...);
-
#ifndef LOCK_SH
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
return -2;
}
if (status.st_size != ninodes * sizeof(struct ViceInodeInfo)) {
- Log("Wrong size (%d instead of %d) in inode file for %s\n",
- status.st_size, ninodes * sizeof(struct ViceInodeInfo),
+ Log("Wrong size (%d instead of %lu) in inode file for %s\n",
+ (int) status.st_size,
+ (long unsigned int) ninodes * sizeof(struct ViceInodeInfo),
mountedOn);
return -2;
}
if (read(fdr, &vd, sizeof(struct VolumeDiskData)) !=
sizeof(struct VolumeDiskData)) {
- Log("1 convertVolumeInfo: read failed for %lu with code %d\n", vid,
+ Log("1 convertVolumeInfo: read failed for %lu with code %d\n",
+ afs_printable_uint32_lu(vid),
errno);
return -1;
}
}
if (write(fdw, &vd, sizeof(struct VolumeDiskData)) !=
sizeof(struct VolumeDiskData)) {
- Log("1 convertVolumeInfo: write failed for %lu with code %d\n", vid,
+ Log("1 convertVolumeInfo: write failed for %lu with code %d\n",
+ afs_printable_uint32_lu(vid),
errno);
return -1;
}
continue;
}
}
- Log("1 namei_ConvertROtoRWvolume: found special file %s/%s for volume %lu\n", dir_name, dp->d_name, info.u.param[0]);
+ Log("1 namei_ConvertROtoRWvolume: found special file %s/%s"
+ " for volume %lu\n", dir_name, dp->d_name,
+ afs_printable_uint32_lu(info.u.param[0]));
closedir(dirp);
code = VVOLEXISTS;
goto done;
#include "salvage.h"
#include "daemon_com.h"
#include "fssync.h"
+#include "common.h"
#ifdef O_LARGEFILE
#define afs_stat stat64
#define afs_stat stat
#endif /* !O_LARGEFILE */
-/*@printflike@*/ extern void Log(const char *format, ...);
-
-
struct Lock localLock;
#define MAXATONCE 100
#include "lwp.h"
#include <afs/afssyscalls.h>
#include "ihandle.h"
+#include "common.h"
#ifdef AFS_NAMEI_ENV
#ifdef AFS_NT40_ENV
#include "ntops.h"
#endif /* !O_LARGEFILE */
-/*@printflike@*/ extern void Log(const char *format, ...);
-
int aixlow_water = 8; /* default 8% */
struct DiskPartition64 *DiskPartitionList;
struct DiskPartition64 *dp;
for (dp = DiskPartitionList; dp; dp = dp->next) {
if (dp->free < 0) {
- Log("Partition %s: %d available 1K blocks (minfree=%d), "
- "overallocated by %d blocks\n", dp->name,
+ Log("Partition %s: %"AFS_INT64_FMT
+ " available 1K blocks (minfree=%"AFS_INT64_FMT"), "
+ "overallocated by %"AFS_INT64_FMT" blocks\n", dp->name,
dp->totalUsable, dp->minFree, -dp->free);
} else {
- Log("Partition %s: %d available 1K blocks (minfree=%d), "
- "%d free blocks\n", dp->name,
+ Log("Partition %s: %"AFS_INT64_FMT
+ " available 1K blocks (minfree=%"AFS_INT64_FMT"), "
+ "%"AFS_INT64_FMT" free blocks\n", dp->name,
dp->totalUsable, dp->minFree, dp->free);
}
}
#include "partition.h"
#include "daemon_com.h"
#include "fssync.h"
+#include "common.h"
/* forward declarations */
static int ObliterateRegion(Volume * avp, VnodeClass aclass, StreamHandle_t * afile,
static void PurgeIndex_r(Volume * vp, VnodeClass class);
static void PurgeHeader_r(Volume * vp);
-/*@printflike@*/ extern void Log(const char *format, ...);
-
/* No lock needed. Only the volserver will call this, and only one transaction
* can have a given volume (volid/partition pair) in use at a time
*/
#include "viceinode.h"
#include "salvage.h"
#include "vol-salvage.h"
+#include "common.h"
#ifdef AFS_NT40_ENV
#include <pthread.h>
#endif
#error "online salvager not supported on NT"
#endif /* AFS_NT40_ENV */
-
-/* Forward declarations */
-/*@printflike@*/ void Log(const char *format, ...);
-
-
/*@+fcnmacros +macrofcndecl@*/
#ifdef O_LARGEFILE
#define afs_fopen fopen64
#include "viceinode.h"
#include "salvage.h"
#include "vol-salvage.h"
+#include "common.h"
#ifdef AFS_NT40_ENV
#include <pthread.h>
pthread_t main_thread;
#endif
-
static int get_salvage_lock = 0;
-
-/* Forward declarations */
-/*@printflike@*/ void Log(const char *format, ...);
-/*@printflike@*/ void Abort(const char *format, ...);
-
-
static int
handleit(struct cmd_syndesc *as, void *arock)
{
#include "vnode.h"
#include "volume.h"
#include "partition.h"
+#include "common.h"
#include <rx/rx_queue.h>
-/*@printflike@*/ extern void Log(const char *format, ...);
-
#ifdef AFS_DEMAND_ATTACH_FS
/*
* SALVSYNC is a feature specific to the demand attach fileserver
#include "vnode.h"
#include "volume.h"
#include "partition.h"
+#include "common.h"
#include <rx/rx_queue.h>
#include <afs/procmgmt.h>
#define WCOREDUMP(x) ((x) & 0200)
#endif
-/*@printflike@*/ extern void Log(const char *format, ...);
-
#define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that
* move = dump+restore can run on single server */
#include "vnode_inline.h"
#include "partition.h"
#include "salvsync.h"
+#include "common.h"
#if defined(AFS_SGI_ENV)
#include "sys/types.h"
#include "fcntl.h"
# include <stdint.h>
#endif
-/*@printflike@*/ extern void Log(const char *format, ...);
-
-/*@printflike@*/ extern void Abort(const char *format, ...) AFS_NORETURN;
-
-
struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
void VNLog(afs_int32 aop, afs_int32 anparms, ... );
goto error_encountered;
}
if (FDH_SEEK(fdP, offset, SEEK_SET) < 0) {
- Log("VnStore: can't seek on index file! fdp=0x%x offset=%d, errno=%d\n",
- fdP, offset, errno);
+ Log("VnStore: can't seek on index file! fdp=%"AFS_PTR_FMT
+ " offset=%d, errno=%d\n",
+ fdP, (int) offset, errno);
goto error_encountered;
}
changed_oldTime) << 1) | vnp->
delete, 0, 0);
if (thisProcess != vnp->writer)
- Abort("VPutVnode: Vnode at 0x%x locked by another process!\n",
+ Abort("VPutVnode: Vnode at %"AFS_PTR_FMT" locked by another process!\n",
vnp);
} else { /* Not write locked */
if (vnp->changed_newTime || vnp->changed_oldTime || vnp->delete)
Abort
- ("VPutVnode: Change or delete flag for vnode 0x%x is set but vnode is not write locked!\n",
+ ("VPutVnode: Change or delete flag for vnode "
+ "%"AFS_PTR_FMT" is set but vnode is not write locked!\n",
vnp);
#ifdef AFS_DEMAND_ATTACH_FS
VnEndRead_r(vnp);
LWP_CurrentProcess(&thisProcess);
#endif /* AFS_PTHREAD_ENV */
if (thisProcess != vnp->writer)
- Abort("VPutVnode: Vnode at 0x%x locked by another process!\n",
- (intptr_t)vnp);
+ Abort("VPutVnode: Vnode at %"AFS_PTR_FMT
+ " locked by another process!\n", vnp);
if (vnp->delete) {
return 0;
#include "salvage.h"
#include "volinodes.h" /* header magic number, etc. stuff */
#include "vol-salvage.h"
+#include "common.h"
#include "vol_internal.h"
#include <afs/acl.h>
#include <afs/prs_fs.h>
/* Forward declarations */
-/*@printflike@*/ void Log(const char *format, ...);
-/*@printflike@*/ void Abort(const char *format, ...) AFS_NORETURN;
static int IsVnodeOrphaned(VnodeId vnode);
static int AskVolumeSummary(VolumeId singleVolumeNumber);
assert(ret == st_status);
}
nVolumesInInodeFile =(unsigned long)(status.st_size) / sizeof(struct InodeSummary);
- Log("%d nVolumesInInodeFile %d \n",nVolumesInInodeFile,(unsigned long)(status.st_size));
+ Log("%d nVolumesInInodeFile %lu \n",nVolumesInInodeFile,(unsigned long)(status.st_size));
fclose(summaryFile);
return 0;
}
#include "volume.h"
#include "partition.h"
#include "volume_inline.h"
+#include "common.h"
+
#ifdef AFS_PTHREAD_ENV
#include <assert.h>
#else /* AFS_PTHREAD_ENV */
extern void *calloc(), *realloc();
#endif
-/*@printflike@*/ extern void Log(const char *format, ...);
-
/* Forward declarations */
static Volume *attach2(Error * ec, VolId volumeId, char *path,
struct DiskPartition64 *partp, Volume * vp,
#include "volinodes.h"
#include "vol_prototypes.h"
+#include "common.h"
#ifdef AFS_AIX_ENV
#include <sys/lockf.h>
#define afs_open open
#endif /* !O_LARGEFILE */
-/*@printflike@*/ extern void Log(const char *format, ...);
-
#define nFILES (sizeof (stuff)/sizeof(struct stuff))
/* Note: the volume creation functions herein leave the destroyMe flag in the