mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
logging-changes-for-large-files-20030619
FIXES 1493 create afs_vsnprintf. use it in FSLog. add new types which are intmax and uintmax, 32 or 64 bit as needed.. some casting.
This commit is contained in:
parent
106a54eef7
commit
befd22d01d
@ -761,7 +761,7 @@ AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
|
||||
AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h)
|
||||
|
||||
AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
|
||||
AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp)
|
||||
AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf)
|
||||
AC_CHECK_TYPE(ssize_t, int)
|
||||
AC_SIZEOF_TYPE(long)
|
||||
|
||||
|
@ -105,6 +105,16 @@ typedef afs_int32 afs_sfsize_t;
|
||||
#define SplitOffsetOrSize(t,h,l) (h) = 0; (l) = (t);
|
||||
#endif /* !AFS_LARGEFILE_ENV */
|
||||
|
||||
/* Maximum integer sizes. Also what is expected by %lld, %llu in
|
||||
* afs_snprintf. */
|
||||
#ifdef AFS_64BIT_CLIENT
|
||||
typedef afs_int64 afs_intmax_t;
|
||||
typedef afs_uint64 afs_uintmax_t;
|
||||
#else /* !AFS_64BIT_CLIENT */
|
||||
typedef afs_int32 afs_intmax_t;
|
||||
typedef afs_uint32 afs_uintmax_t;
|
||||
#endif /* !AFS_64BIT_CLIENT */
|
||||
|
||||
/* you still have to include <netinet/in.h> to make these work */
|
||||
|
||||
#define hton32 htonl
|
||||
|
@ -369,3 +369,9 @@ dest: \
|
||||
${DEST}/lib/afs/libafsutil.a \
|
||||
${DEST}/bin/sys
|
||||
|
||||
splint:
|
||||
splint $(CFLAGS) \
|
||||
assert.c base64.c casestrcpy.c ktime.c volparse.c hostparse.c \
|
||||
hputil.c kreltime.c isathing.c get_krbrlm.c uuid.c serverLog.c \
|
||||
dirpath.c fileutil.c netutils.c flipbase64.c \
|
||||
afs_atomlist.c afs_lhash.c snprintf.c
|
||||
|
@ -39,6 +39,18 @@ extern int OpenLog(const char *filename);
|
||||
extern int ReOpenLog(const char *fileName);
|
||||
extern void SetupLogSignals(void);
|
||||
|
||||
extern int
|
||||
afs_vsnprintf(/*@out@*/char *p, size_t avail, const char *fmt,
|
||||
va_list ap)
|
||||
/*@requires maxSet(p) >= (avail-1)@*/
|
||||
/*@modifies p@*/;
|
||||
|
||||
extern /*@printflike@*/ int
|
||||
afs_snprintf(/*@out@*/char *p, size_t avail,
|
||||
const char *fmt, ...)
|
||||
/*@requires maxSet(p) >= (avail-1)@*/
|
||||
/*@modifies p@*/;
|
||||
|
||||
|
||||
/* special version of ctime that clobbers a *different static variable, so
|
||||
* that ViceLog can call ctime and not cause buffer confusion.
|
||||
|
@ -61,16 +61,16 @@ static void initDirPathArray(void);
|
||||
/* Additional macros for ease of use */
|
||||
/* buf is expected to be atleast AFS_PATH_MAX bytes long */
|
||||
#define AFSDIR_SERVER_DIRPATH(buf, dir) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, NULL)
|
||||
(void) strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, NULL)
|
||||
|
||||
#define AFSDIR_SERVER_FILEPATH(buf, dir, file) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, "/", file, NULL)
|
||||
(void) strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, "/", file, NULL)
|
||||
|
||||
#define AFSDIR_CLIENT_DIRPATH(buf, dir) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, NULL)
|
||||
(void) strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, NULL)
|
||||
|
||||
#define AFSDIR_CLIENT_FILEPATH(buf, dir, file) \
|
||||
strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, "/", file, NULL)
|
||||
(void) strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, "/", file, NULL)
|
||||
|
||||
|
||||
/* initAFSDirPath() -- External users call this function to initialize
|
||||
|
@ -87,7 +87,7 @@ void WriteLogBuffer(char *buf, afs_uint32 len)
|
||||
{
|
||||
LOCK_SERVERLOG();
|
||||
if (serverLogFD > 0)
|
||||
write(serverLogFD, buf, len);
|
||||
(void) write(serverLogFD, buf, len);
|
||||
UNLOCK_SERVERLOG();
|
||||
}
|
||||
|
||||
@ -107,11 +107,13 @@ void vFSLog (const char *format, va_list args)
|
||||
|
||||
if (mrafsStyleLogs) {
|
||||
name = (*threadNameProgram)();
|
||||
sprintf(info, "[%s] ", name);
|
||||
(void) afs_snprintf(info, (sizeof tbuffer) - strlen(tbuffer),
|
||||
"[%s] ", name);
|
||||
info += strlen(info);
|
||||
}
|
||||
|
||||
(void) vsprintf(info, format, args);
|
||||
(void) afs_vsnprintf(info, (sizeof tbuffer) - strlen(tbuffer),
|
||||
format, args);
|
||||
|
||||
len = strlen(tbuffer);
|
||||
LOCK_SERVERLOG();
|
||||
@ -121,7 +123,7 @@ void vFSLog (const char *format, va_list args)
|
||||
} else
|
||||
#endif
|
||||
if (serverLogFD > 0)
|
||||
write(serverLogFD, tbuffer, len);
|
||||
(void) write(serverLogFD, tbuffer, len);
|
||||
UNLOCK_SERVERLOG();
|
||||
|
||||
#if !defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
|
||||
@ -172,8 +174,9 @@ void SetDebug_Signal(int signo)
|
||||
IOMGR_SoftSig(DebugOn, LogLevel);
|
||||
#endif /* AFS_PTHREAD_ENV */
|
||||
|
||||
signal(signo, SetDebug_Signal); /* on some platforms, this signal */
|
||||
/* handler needs to be set again */
|
||||
(void) signal(signo, SetDebug_Signal); /* on some platforms, this
|
||||
* signal handler needs to
|
||||
* be set again */
|
||||
} /*SetDebug_Signal*/
|
||||
|
||||
void ResetDebug_Signal(int signo)
|
||||
@ -187,8 +190,10 @@ void ResetDebug_Signal(int signo)
|
||||
IOMGR_SoftSig(DebugOn, (void *)LogLevel);
|
||||
#endif /* AFS_PTHREAD_ENV */
|
||||
|
||||
signal(signo, ResetDebug_Signal); /* on some platforms, this signal */
|
||||
/* handler needs to be set again */
|
||||
(void) signal(signo, ResetDebug_Signal); /* on some platforms,
|
||||
* this signal handler
|
||||
* needs to be set
|
||||
* again */
|
||||
if (mrafsStyleLogs)
|
||||
OpenLog((char *)&ourName);
|
||||
} /*ResetDebug_Signal*/
|
||||
@ -196,9 +201,9 @@ void ResetDebug_Signal(int signo)
|
||||
|
||||
void SetupLogSignals(void)
|
||||
{
|
||||
signal(SIGHUP, ResetDebug_Signal);
|
||||
(void) signal(SIGHUP, ResetDebug_Signal);
|
||||
/* Note that we cannot use SIGUSR1 -- Linux stole it for pthreads! */
|
||||
signal(SIGTSTP, SetDebug_Signal);
|
||||
(void) signal(SIGTSTP, SetDebug_Signal);
|
||||
}
|
||||
|
||||
int OpenLog(const char *fileName)
|
||||
@ -227,7 +232,8 @@ int OpenLog(const char *fileName)
|
||||
if (strncmp(fileName, (char *)&ourName, strlen(fileName)))
|
||||
strcpy((char *)&ourName, (char *) fileName);
|
||||
}
|
||||
sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", ourName,
|
||||
afs_snprintf(FileName, MAXPATHLEN, "%s.%d%02d%02d%02d%02d%02d",
|
||||
ourName,
|
||||
TimeFields->tm_year + 1900, TimeFields->tm_mon + 1,
|
||||
TimeFields->tm_mday, TimeFields->tm_hour,
|
||||
TimeFields->tm_min, TimeFields->tm_sec);
|
||||
@ -258,8 +264,8 @@ int OpenLog(const char *fileName)
|
||||
serverLogFD = tempfd;
|
||||
#else
|
||||
close(tempfd); /* just checking.... */
|
||||
freopen(fileName, "w", stdout);
|
||||
freopen(fileName, "w", stderr);
|
||||
(void) freopen(fileName, "w", stdout);
|
||||
(void) freopen(fileName, "w", stderr);
|
||||
serverLogFD = fileno(stdout);
|
||||
#endif /* AFS_PTHREAD_ENV */
|
||||
|
||||
@ -298,8 +304,8 @@ int ReOpenLog(const char *fileName)
|
||||
}
|
||||
close(tempfd);
|
||||
|
||||
freopen(fileName, "a", stdout);
|
||||
freopen(fileName, "a", stderr);
|
||||
(void) freopen(fileName, "a", stdout);
|
||||
(void) freopen(fileName, "a", stderr);
|
||||
serverLogFD = fileno(stdout);
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
RCSID("$Header$");
|
||||
|
||||
#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_SNPRINTF)
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@ -26,7 +25,8 @@ RCSID("$Header$");
|
||||
* to receive it. The minimum length is <prec> or ceil(log{base}(val)),
|
||||
* whichever is larger, plus room for a trailing NUL.
|
||||
*/
|
||||
static void mkint(char *buf, unsigned long val, int base, int uc, int prec)
|
||||
static void mkint(char *buf, afs_uintmax_t val,
|
||||
int base, int uc, unsigned prec)
|
||||
{
|
||||
int len = 0, dig, i;
|
||||
|
||||
@ -118,11 +118,7 @@ static void mkint(char *buf, unsigned long val, int base, int uc, int prec)
|
||||
* both '0' and ' ' are given, the ' ' flag will be ignored.
|
||||
* + The '#' and '+' flags have no effect.
|
||||
*/
|
||||
#ifdef AFS_AIX51_ENV
|
||||
static int vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
|
||||
#else
|
||||
static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
#endif
|
||||
int afs_vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
|
||||
{
|
||||
unsigned int width, precision, haveprec, len;
|
||||
int ljust, plsign, spsign, altform, zfill;
|
||||
@ -130,8 +126,10 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
char *x, *y, xbuf[MAXPREC + 21], fbuf[20];
|
||||
struct hostent *he;
|
||||
struct in_addr ia;
|
||||
unsigned long UVAL;
|
||||
long SVAL, *lcountp;
|
||||
afs_uintmax_t UVAL;
|
||||
afs_intmax_t SVAL;
|
||||
afs_intmax_t* llcountp;
|
||||
long *lcountp;
|
||||
double FVAL;
|
||||
short *hcountp;
|
||||
|
||||
@ -190,7 +188,8 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
while (*fmt) {
|
||||
switch (*fmt) {
|
||||
case 'h': hflag = 1; fmt++; continue; /* short argument */
|
||||
case 'l': lflag = 1; fmt++; continue; /* long argument */
|
||||
case 'l': lflag += 1; fmt++; continue; /* long argument */
|
||||
case 'L': lflag = 2; fmt++; continue; /* long long argument */
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
@ -216,7 +215,8 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
|
||||
case 'i':
|
||||
case 'd': /* signed decimal integer */
|
||||
if (lflag) SVAL = va_arg(ap, long);
|
||||
if (lflag > 1) SVAL = va_arg(ap, afs_intmax_t);
|
||||
else if (lflag) SVAL = va_arg(ap, long);
|
||||
else if (hflag) SVAL = va_arg(ap, short);
|
||||
else SVAL = va_arg(ap, int);
|
||||
UVAL = (SVAL < 0) ? -SVAL : SVAL;
|
||||
@ -240,7 +240,8 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
|
||||
|
||||
case 'o': /* unsigned octal integer */
|
||||
if (lflag) UVAL = va_arg(ap, unsigned long);
|
||||
if (lflag > 1) UVAL = va_arg(ap, afs_uintmax_t);
|
||||
else if (lflag) UVAL = va_arg(ap, unsigned long);
|
||||
else if (hflag) UVAL = va_arg(ap, unsigned short);
|
||||
else UVAL = va_arg(ap, unsigned int);
|
||||
|
||||
@ -258,7 +259,8 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
break;
|
||||
|
||||
case 'u': /* unsigned decimal integer */
|
||||
if (lflag) UVAL = va_arg(ap, unsigned long);
|
||||
if (lflag > 1) UVAL = va_arg(ap, afs_uintmax_t);
|
||||
else if (lflag) UVAL = va_arg(ap, unsigned long);
|
||||
else if (hflag) UVAL = va_arg(ap, unsigned short);
|
||||
else UVAL = va_arg(ap, unsigned int);
|
||||
|
||||
@ -275,7 +277,8 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
|
||||
case 'x':
|
||||
case 'X': /* unsigned hexadecimal integer */
|
||||
if (lflag) UVAL = va_arg(ap, unsigned long);
|
||||
if (lflag > 1) UVAL = va_arg(ap, afs_uintmax_t);
|
||||
else if (lflag) UVAL = va_arg(ap, unsigned long);
|
||||
else if (hflag) UVAL = va_arg(ap, unsigned short);
|
||||
else UVAL = va_arg(ap, unsigned int);
|
||||
|
||||
@ -347,12 +350,15 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
break;
|
||||
|
||||
case 'n': /* report count so far */
|
||||
if (lflag) {
|
||||
if (lflag > 1) {
|
||||
llcountp = va_arg(ap, afs_intmax_t *);
|
||||
*llcountp = (long long) count;
|
||||
} else if (lflag) {
|
||||
lcountp = va_arg(ap, long *);
|
||||
*lcountp = count;
|
||||
*lcountp = (long) count;
|
||||
} else if (hflag) {
|
||||
hcountp = va_arg(ap, short *);
|
||||
*hcountp = count;
|
||||
*hcountp = (short) count;
|
||||
} else {
|
||||
countp = va_arg(ap, int *);
|
||||
*countp = count;
|
||||
@ -383,8 +389,37 @@ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
if (ljust) while (j-- > 0) *p++ = ' ';
|
||||
}
|
||||
*p = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
int afs_snprintf(char *p, size_t avail, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start(ap, fmt);
|
||||
result = afs_vsnprintf(p, avail, fmt, ap);
|
||||
va_end(ap);
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_VSNPRINTF)
|
||||
|
||||
#ifdef AFS_AIX51_ENV
|
||||
int vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
|
||||
#else
|
||||
void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
|
||||
#endif
|
||||
{
|
||||
int result;
|
||||
result = afs_vsnprintf(p, avail, fmt, ap);
|
||||
#ifdef AFS_AIX51_ENV
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
|
||||
|
||||
#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_SNPRINTF)
|
||||
|
||||
#ifdef AFS_AIX51_ENV
|
||||
int snprintf(char *p, size_t avail, const char *fmt, ...)
|
||||
@ -392,10 +427,14 @@ int snprintf(char *p, size_t avail, const char *fmt, ...)
|
||||
void snprintf(char *p, unsigned int avail, char *fmt, ...)
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(p, avail, fmt, ap);
|
||||
va_end(ap);
|
||||
va_start(ap, fmt);
|
||||
result = afs_vsnprintf(p, avail, fmt, ap);
|
||||
va_end(ap);
|
||||
#ifdef AFS_AIX51_ENV
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
|
||||
|
@ -1587,7 +1587,7 @@ Alloc_NewVnode(Vnode *parentptr,
|
||||
/* error in creating inode */
|
||||
if (!VALID_INO(inode))
|
||||
{
|
||||
ViceLog(0, ("Volume : %d vnode = %d Failed to create inode: errno = %d\n",
|
||||
ViceLog(0, ("Volume : %u vnode = %u Failed to create inode: errno = %d\n",
|
||||
(*targetptr)->volumePtr->header->diskstuff.id,
|
||||
(*targetptr)->vnodeNumber,
|
||||
errno));
|
||||
@ -2064,7 +2064,7 @@ afs_int32 common_FetchData64 (struct rx_call *acall,
|
||||
TM_GetTimeOfDay(&opStartTime, 0);
|
||||
#endif /* FS_STATS_DETAILED */
|
||||
|
||||
ViceLog(1,("SRXAFS_FetchData, Fid = %u.%d.%d\n",
|
||||
ViceLog(1,("SRXAFS_FetchData, Fid = %u.%u.%u\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique));
|
||||
FS_LOCK
|
||||
AFSCallStats.FetchData++, AFSCallStats.TotalCalls++;
|
||||
@ -2076,7 +2076,7 @@ afs_int32 common_FetchData64 (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(5,("SRXAFS_FetchData, Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(5,("SRXAFS_FetchData, Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
/*
|
||||
@ -2332,7 +2332,7 @@ afs_int32 SRXAFS_FetchACL (struct rx_call *acall,
|
||||
TM_GetTimeOfDay(&opStartTime, 0);
|
||||
#endif /* FS_STATS_DETAILED */
|
||||
|
||||
ViceLog(1, ("SAFS_FetchACL, Fid = %u.%d.%d\n",
|
||||
ViceLog(1, ("SAFS_FetchACL, Fid = %u.%u.%u\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique));
|
||||
FS_LOCK
|
||||
AFSCallStats.FetchACL++, AFSCallStats.TotalCalls++;
|
||||
@ -2343,7 +2343,7 @@ afs_int32 SRXAFS_FetchACL (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(5, ("SAFS_FetchACL, Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(5, ("SAFS_FetchACL, Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
|
||||
@ -2434,7 +2434,7 @@ afs_int32 SAFSS_FetchStatus (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_FetchStatus, Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_FetchStatus, Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -2886,7 +2886,7 @@ afs_int32 common_StoreData64 (struct rx_call *acall,
|
||||
(opP->numOps)++;
|
||||
FS_UNLOCK
|
||||
|
||||
ViceLog(1, ("StoreData: Fid = %u.%d.%d\n",
|
||||
ViceLog(1, ("StoreData: Fid = %u.%u.%u\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique));
|
||||
TM_GetTimeOfDay(&opStartTime, 0);
|
||||
#endif /* FS_STATS_DETAILED */
|
||||
@ -2901,7 +2901,7 @@ afs_int32 common_StoreData64 (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(5, ("StoreData: Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(5, ("StoreData: Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
|
||||
@ -3164,7 +3164,7 @@ afs_int32 SRXAFS_StoreACL (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_StoreACL, Fid = %u.%d.%d, ACL=%s, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_StoreACL, Fid = %u.%u.%u, ACL=%s, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique, AccessList->AFSOpaque_val,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -3264,7 +3264,7 @@ SAFSS_StoreStatus (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_StoreStatus, Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_StoreStatus, Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -3407,7 +3407,7 @@ SAFSS_RemoveFile (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_RemoveFile %s, Did = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_RemoveFile %s, Did = %u.%u.%u, Host %s, Id %d\n",
|
||||
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -3569,7 +3569,7 @@ SAFSS_CreateFile (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_CreateFile %s, Did = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_CreateFile %s, Did = %u.%u.%u, Host %s, Id %d\n",
|
||||
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -3751,7 +3751,7 @@ SAFSS_Rename (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_Rename %s to %s, Fid = %u.%d.%d to %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_Rename %s to %s, Fid = %u.%u.%u to %u.%u.%u, Host %s, Id %d\n",
|
||||
OldName, NewName, OldDirFid->Volume, OldDirFid->Vnode,
|
||||
OldDirFid->Unique, NewDirFid->Volume, NewDirFid->Vnode,
|
||||
NewDirFid->Unique,
|
||||
@ -4210,7 +4210,7 @@ SAFSS_Symlink (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_Symlink %s to %s, Did = %u.%d.%d, Host %s, Id %d\n", Name,
|
||||
ViceLog(1, ("SAFS_Symlink %s to %s, Did = %u.%u.%u, Host %s, Id %d\n", Name,
|
||||
LinkContents, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -4405,7 +4405,7 @@ SAFSS_Link (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_Link %s, Did = %u.%d.%d, Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_Link %s, Did = %u.%u.%u, Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
|
||||
ExistingFid->Volume, ExistingFid->Vnode, ExistingFid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
@ -4612,7 +4612,7 @@ SAFSS_MakeDir (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_MakeDir %s, Did = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_MakeDir %s, Did = %u.%u.%u, Host %s, Id %d\n",
|
||||
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -4804,7 +4804,7 @@ SAFSS_RemoveDir (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1, ("SAFS_RemoveDir %s, Did = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1, ("SAFS_RemoveDir %s, Did = %u.%u.%u, Host %s, Id %d\n",
|
||||
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -4959,7 +4959,7 @@ SAFSS_SetLock (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1,("SAFS_SetLock type = %s Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1,("SAFS_SetLock type = %s Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
locktype[(int)type], Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -5085,7 +5085,7 @@ SAFSS_ExtendLock (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1,("SAFS_ExtendLock Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1,("SAFS_ExtendLock Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -5209,7 +5209,7 @@ SAFSS_ReleaseLock (struct rx_call *acall,
|
||||
/* Get ptr to client data for user Id for logging */
|
||||
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
|
||||
ViceLog(1,("SAFS_ReleaseLock Fid = %u.%d.%d, Host %s, Id %d\n",
|
||||
ViceLog(1,("SAFS_ReleaseLock Fid = %u.%u.%u, Host %s, Id %d\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
inet_ntoa(logHostAddr), t_client->ViceId));
|
||||
FS_LOCK
|
||||
@ -6577,7 +6577,7 @@ afs_int32 SRXAFS_GetTime (struct rx_call *acall,
|
||||
*Seconds = tpl.tv_sec;
|
||||
*USeconds = tpl.tv_usec;
|
||||
|
||||
ViceLog(2, ("SAFS_GetTime returns %d, %d\n", *Seconds, *USeconds));
|
||||
ViceLog(2, ("SAFS_GetTime returns %u, %u\n", *Seconds, *USeconds));
|
||||
|
||||
Bad_GetTime:
|
||||
code = CallPostamble(tcon, code);
|
||||
@ -6876,9 +6876,10 @@ StoreData_RXStyle(Volume *volptr,
|
||||
if (Pos == -1 || VN_GET_INO(targetptr) == 0) {
|
||||
/* the inode should have been created in Alloc_NewVnode */
|
||||
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(rx_ConnectionOf(Call)));
|
||||
ViceLog(0, ("StoreData_RXStyle : Inode non-existent Fid = %u.%d.%d, inode = %d, Pos %d Host %s\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
VN_GET_INO(targetptr), Pos, inet_ntoa(logHostAddr) ));
|
||||
ViceLog(0, ("StoreData_RXStyle : Inode non-existent Fid = %u.%u.%u, inode = %llu, Pos %d Host %s\n",
|
||||
Fid->Volume, Fid->Vnode, Fid->Unique,
|
||||
(afs_uintmax_t)VN_GET_INO(targetptr),
|
||||
Pos, inet_ntoa(logHostAddr) ));
|
||||
return ENOENT; /* is this proper error code? */
|
||||
}
|
||||
else {
|
||||
|
@ -795,7 +795,7 @@ static void MultiBreakCallBack_r(struct cbstruct cba[], int ncbas,
|
||||
{
|
||||
if (ShowProblems) {
|
||||
ViceLog(7,
|
||||
("BCB: Failed on file %u.%d.%d, host %s:%d is down\n",
|
||||
("BCB: Failed on file %u.%u.%u, host %s:%d is down\n",
|
||||
afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode,
|
||||
afidp->AFSCBFids_val->Unique, afs_inet_ntoa_r(hp->host,hoststr), ntohs(hp->port)));
|
||||
}
|
||||
@ -848,7 +848,7 @@ int BreakCallBack(struct host *xhost, AFSFid *fid, int flag)
|
||||
int hostindex;
|
||||
char hoststr[16];
|
||||
|
||||
ViceLog(7,("BCB: BreakCallBack(all but %s:%d, (%u,%d,%d))\n",
|
||||
ViceLog(7,("BCB: BreakCallBack(all but %s:%d, (%u,%u,%u))\n",
|
||||
afs_inet_ntoa_r(xhost->host,hoststr), ntohs(xhost->port), fid->Volume, fid->Vnode,
|
||||
fid->Unique));
|
||||
|
||||
@ -932,13 +932,13 @@ int DeleteCallBack(struct host *host, AFSFid *fid)
|
||||
if (!fe) {
|
||||
h_Unlock_r(host);
|
||||
H_UNLOCK
|
||||
ViceLog(8,("DCB: No call backs for fid (%u, %d, %d)\n",
|
||||
ViceLog(8,("DCB: No call backs for fid (%u, %u, %u)\n",
|
||||
fid->Volume, fid->Vnode, fid->Unique));
|
||||
return 0;
|
||||
}
|
||||
pcb = FindCBPtr(fe, host);
|
||||
if (!*pcb) {
|
||||
ViceLog(8,("DCB: No call back for host %s:%d, (%u, %d, %d)\n",
|
||||
ViceLog(8,("DCB: No call back for host %s:%d, (%u, %u, %u)\n",
|
||||
afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique));
|
||||
h_Unlock_r(host);
|
||||
H_UNLOCK
|
||||
@ -1302,7 +1302,7 @@ int BreakVolumeCallBacksLater(afs_uint32 volume)
|
||||
struct host *host;
|
||||
int found = 0;
|
||||
|
||||
ViceLog(25, ("Setting later on volume %d\n", volume));
|
||||
ViceLog(25, ("Setting later on volume %u\n", volume));
|
||||
H_LOCK
|
||||
for (hash=0; hash<VHASH; hash++) {
|
||||
for (feip = &HashTable[hash]; fe = itofe(*feip); ) {
|
||||
@ -1361,7 +1361,7 @@ int BreakLaterCallBacks(void)
|
||||
for (feip = &HashTable[hash]; fe = itofe(*feip); ) {
|
||||
if (fe && (fe->status & FE_LATER) &&
|
||||
(fid.Volume == 0 || fid.Volume == fe->volid)) {
|
||||
ViceLog(125, ("Unchaining for %d:%d:%d\n", fe->vnode,
|
||||
ViceLog(125, ("Unchaining for %u:%u:%u\n", fe->vnode,
|
||||
fe->unique, fe->volid));
|
||||
fid.Volume = fe->volid;
|
||||
*feip = fe->fnext;
|
||||
@ -1401,7 +1401,7 @@ int BreakLaterCallBacks(void)
|
||||
}
|
||||
|
||||
if (tthead) {
|
||||
ViceLog(125, ("Breaking volume %d\n", fid.Volume));
|
||||
ViceLog(125, ("Breaking volume %u\n", fid.Volume));
|
||||
henumParms.ncbas = 0;
|
||||
henumParms.fid = &fid;
|
||||
henumParms.thead = tthead;
|
||||
|
@ -1611,32 +1611,40 @@ h_PrintClient(register struct host *host, int held, StreamHandle_t *file)
|
||||
H_UNLOCK
|
||||
return held;
|
||||
}
|
||||
sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s",
|
||||
afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
|
||||
(host->hostFlags & VENUSDOWN),
|
||||
afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer)));
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
"Host %s:%d down = %d, LastCall %s",
|
||||
afs_inet_ntoa_r(host->host, hoststr),
|
||||
ntohs(host->port),
|
||||
(host->hostFlags & VENUSDOWN),
|
||||
afs_ctime((time_t *)&host->LastCall,
|
||||
tbuffer, sizeof(tbuffer)));
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
for (client = host->FirstClient; client; client=client->next) {
|
||||
if (!client->deleted) {
|
||||
if (client->tcon) {
|
||||
sprintf(tmpStr, " user id=%d, name=%s, sl=%s till %s",
|
||||
client->ViceId, h_UserName(client),
|
||||
client->authClass ? "Authenticated" : "Not authenticated",
|
||||
client->authClass ?
|
||||
afs_ctime((time_t *)&client->expTime, tbuffer, sizeof(tbuffer))
|
||||
: "No Limit\n");
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
" user id=%d, name=%s, sl=%s till %s",
|
||||
client->ViceId, h_UserName(client),
|
||||
client->authClass ?
|
||||
"Authenticated" : "Not authenticated",
|
||||
client->authClass ?
|
||||
afs_ctime((time_t *)&client->expTime, tbuffer, sizeof(tbuffer))
|
||||
: "No Limit\n");
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
}
|
||||
else {
|
||||
sprintf(tmpStr, " user=%s, no current server connection\n",
|
||||
h_UserName(client));
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
" user=%s, no current server connection\n",
|
||||
h_UserName(client));
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
}
|
||||
sprintf(tmpStr, " CPS-%d is [", client->CPS.prlist_len);
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
" CPS-%d is [", client->CPS.prlist_len);
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
if (client->CPS.prlist_val) {
|
||||
for (i=0; i > client->CPS.prlist_len; i++) {
|
||||
sprintf(tmpStr, " %d", client->CPS.prlist_val[i]);
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
" %d", client->CPS.prlist_val[i]);
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
}
|
||||
}
|
||||
@ -1668,8 +1676,9 @@ void h_PrintClients()
|
||||
return;
|
||||
}
|
||||
now = FT_ApproxTime();
|
||||
sprintf(tmpStr, "List of active users at %s\n",
|
||||
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
"List of active users at %s\n",
|
||||
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
h_Enumerate(h_PrintClient, (char *)file);
|
||||
STREAM_REALLYCLOSE(file);
|
||||
@ -1686,16 +1695,18 @@ h_DumpHost(register struct host *host, int held, StreamHandle_t *file)
|
||||
char tmpStr[256];
|
||||
|
||||
H_LOCK
|
||||
sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
|
||||
host->host, ntohs(host->port), host->index, host->cblist,
|
||||
CheckLock(&host->lock), host->LastCall, host->ActiveCall,
|
||||
(host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED,
|
||||
host->Console, host->hostFlags & CLIENTDELETED,
|
||||
host->hcpsfailed, host->cpsCall);
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
"ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
|
||||
host->host, ntohs(host->port), host->index, host->cblist,
|
||||
CheckLock(&host->lock), host->LastCall, host->ActiveCall,
|
||||
(host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED,
|
||||
host->Console, host->hostFlags & CLIENTDELETED,
|
||||
host->hcpsfailed, host->cpsCall);
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
if (host->hcps.prlist_val)
|
||||
for (i=0; i < host->hcps.prlist_len; i++) {
|
||||
sprintf(tmpStr, " %d", host->hcps.prlist_val[i]);
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr,
|
||||
" %d", host->hcps.prlist_val[i]);
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
}
|
||||
sprintf(tmpStr, "] [");
|
||||
@ -1733,7 +1744,7 @@ void h_DumpHosts()
|
||||
return;
|
||||
}
|
||||
now = FT_ApproxTime();
|
||||
sprintf(tmpStr, "List of active hosts at %s\n",
|
||||
(void) afs_snprintf(tmpStr, sizeof tmpStr, "List of active hosts at %s\n",
|
||||
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
|
||||
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
|
||||
h_Enumerate(h_DumpHost, (char *) file);
|
||||
|
@ -281,10 +281,8 @@ dest: \
|
||||
${DEST}/include/afs/namei_ops.h
|
||||
|
||||
splint::
|
||||
for FILE in \
|
||||
splint $(CFLAGS) \
|
||||
vnode.c volume.c vutil.c partition.c fssync.c purge.c \
|
||||
clone.c nuke.c devname.c listinodes.c common.c ihandle.c \
|
||||
namei_ops.c \
|
||||
physio.c vol-salvage.c vol-info.c ; do \
|
||||
splint $(CFLAGS) $$FILE ; \
|
||||
done
|
||||
physio.c vol-salvage.c vol-info.c
|
||||
|
@ -59,7 +59,7 @@ RCSID("$Header$");
|
||||
#include "partition.h"
|
||||
#include "viceinode.h"
|
||||
|
||||
/*@printfline@*/ extern void Log(const char *format, ...);
|
||||
/*@printflike@*/ extern void Log(const char *format, ...);
|
||||
|
||||
int (*vol_PollProc)() = 0; /* someone must init this */
|
||||
|
||||
@ -239,7 +239,7 @@ afs_int32 DoCloneIndex(Volume *rwvp, Volume *clvp,
|
||||
clinode = 0; /* already cloned - don't delete later */
|
||||
} else if (rwinode) {
|
||||
if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
|
||||
Log("IH_INC failed: %x, %s, %d errno %d\n",
|
||||
Log("IH_INC failed: %x, %s, %u errno %d\n",
|
||||
V_linkHandle(rwvp), PrintInode(NULL, rwinode),
|
||||
V_parentId(rwvp), errno);
|
||||
assert(0);
|
||||
@ -287,7 +287,7 @@ afs_int32 DoCloneIndex(Volume *rwvp, Volume *clvp,
|
||||
/* Couldn't clone, go back and decrement the inode's link count */
|
||||
if (inodeinced) {
|
||||
if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
|
||||
Log("IH_DEC failed: %x, %s, %d errno %d\n",
|
||||
Log("IH_DEC failed: %x, %s, %u errno %d\n",
|
||||
V_linkHandle(rwvp), PrintInode(NULL, rwinode),
|
||||
V_parentId(rwvp), errno);
|
||||
assert(0);
|
||||
|
@ -272,7 +272,7 @@ static void FSYNC_sync() {
|
||||
#endif
|
||||
|
||||
#ifndef AFS_NT40_ENV
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
#ifdef AFS_PTHREAD_ENV
|
||||
|
@ -208,10 +208,12 @@ int namei_ViceREADME(char *partition)
|
||||
int fd;
|
||||
|
||||
/* Create the inode directory if we're starting for the first time */
|
||||
sprintf(filename, "%s/%s", partition, INODEDIR);
|
||||
(void) afs_snprintf(filename, sizeof filename,
|
||||
"%s/%s", partition, INODEDIR);
|
||||
mkdir(filename, 0700);
|
||||
|
||||
sprintf(filename, "%s/%s/README", partition, INODEDIR);
|
||||
(void) afs_snprintf(filename, sizeof filename,
|
||||
"%s/%s/README", partition, INODEDIR);
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0444);
|
||||
if (fd >= 0) {
|
||||
(void) write(fd, VICE_README, strlen(VICE_README));
|
||||
@ -1219,7 +1221,8 @@ static int namei_ListAFSSubDirs(IHandle_t *dirIH,
|
||||
}
|
||||
else {
|
||||
/* Open this handle */
|
||||
(void) sprintf(path2, "%s/%s", path1, dp1->d_name);
|
||||
(void) afs_snprintf(path2, sizeof path2,
|
||||
"%s/%s", path1, dp1->d_name);
|
||||
linkHandle.fd_fd = open(path2, O_RDONLY, 0666);
|
||||
info.linkCount = namei_GetLinkCount(&linkHandle, (Inode)0, 0);
|
||||
}
|
||||
@ -1514,7 +1517,7 @@ int namei_ConvertROtoRWvolume(IHandle_t * h, afs_uint32 vid)
|
||||
t_ih.ih_dev = h->ih_dev;
|
||||
t_ih.ih_vid = h->ih_vid;
|
||||
|
||||
sprintf(oldpath, "%s/%s", dir_name, infoName);
|
||||
(void) afs_snprintf(oldpath, sizeof oldpath, "%s/%s", dir_name, infoName);
|
||||
fd = open(oldpath, O_RDWR, 0);
|
||||
if (fd < 0) {
|
||||
Log("1 namei_ConvertROtoRWvolume: could not open RO info file: %s\n",
|
||||
@ -1542,7 +1545,7 @@ int namei_ConvertROtoRWvolume(IHandle_t * h, afs_uint32 vid)
|
||||
|
||||
t_ih.ih_ino = namei_MakeSpecIno(h->ih_vid, VI_SMALLINDEX);
|
||||
namei_HandleToName(&n, &t_ih);
|
||||
sprintf(newpath, "%s/%s", dir_name, smallName);
|
||||
(void) afs_snprintf(newpath, sizeof newpath, "%s/%s", dir_name, smallName);
|
||||
fd = open(newpath, O_RDWR, 0);
|
||||
if (fd < 0) {
|
||||
Log("1 namei_ConvertROtoRWvolume: could not open SmallIndex file: %s\n",
|
||||
@ -1556,7 +1559,7 @@ int namei_ConvertROtoRWvolume(IHandle_t * h, afs_uint32 vid)
|
||||
|
||||
t_ih.ih_ino = namei_MakeSpecIno(h->ih_vid, VI_LARGEINDEX);
|
||||
namei_HandleToName(&n, &t_ih);
|
||||
sprintf(newpath, "%s/%s", dir_name, largeName);
|
||||
(void) afs_snprintf(newpath, sizeof newpath, "%s/%s", dir_name, largeName);
|
||||
fd = open(newpath, O_RDWR, 0);
|
||||
if (fd < 0) {
|
||||
Log("1 namei_ConvertROtoRWvolume: could not open LargeIndex file: %s\n",
|
||||
@ -1582,9 +1585,9 @@ char * PrintInode(char *s, Inode ino)
|
||||
if (!s)
|
||||
s = result;
|
||||
|
||||
(void) sprintf((char*)s, "%Lu", ino);
|
||||
(void) afs_snprintf(s, sizeof(afs_ino_str_t), "%llu", (afs_uintmax_t) ino);
|
||||
|
||||
return (char*)s;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,9 +205,11 @@ int nuke(char *aname, afs_int32 avolid)
|
||||
*/
|
||||
/* reuse devName buffer now */
|
||||
#ifdef AFS_NT40_ENV
|
||||
sprintf(devName, "%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
|
||||
afs_snprintf(devName, sizeof devName,
|
||||
"%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
|
||||
#else
|
||||
sprintf(devName, "%s/%s", aname, VolumeExternalName(avolid));
|
||||
afs_snprintf(devName, sizeof devName,
|
||||
"%s/%s", aname, VolumeExternalName(avolid));
|
||||
#endif /* AFS_NT40_ENV */
|
||||
code = unlink(devName);
|
||||
if (code) code = errno;
|
||||
|
@ -66,8 +66,9 @@ void VPurgeVolume_r(Error *ec, Volume *vp)
|
||||
* volume header. This routine can, under some circumstances, be called
|
||||
* when two volumes with the same id exist on different partitions.
|
||||
*/
|
||||
sprintf(purgePath, "%s/%s", VPartitionPath(vp->partition),
|
||||
VolumeExternalName(V_id(vp)));
|
||||
(void) afs_snprintf(purgePath, sizeof purgePath,
|
||||
"%s/%s", VPartitionPath(vp->partition),
|
||||
VolumeExternalName(V_id(vp)));
|
||||
PurgeIndex_r(vp, vLarge);
|
||||
PurgeIndex_r(vp, vSmall);
|
||||
PurgeHeader_r(vp);
|
||||
|
@ -63,7 +63,9 @@ RCSID("$Header$");
|
||||
#endif /* AFS_NT40_ENV */
|
||||
#include <sys/stat.h>
|
||||
|
||||
extern void Abort(const char *format, ...);
|
||||
/*@printflike@*/ extern void Log(const char *format, ...);
|
||||
|
||||
/*@printflike@*/ extern void Abort(const char *format, ...);
|
||||
|
||||
|
||||
struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
|
||||
@ -536,7 +538,7 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype)
|
||||
}
|
||||
else if (FDH_SEEK(fdP, vnodeIndexOffset(vcp, vnodeNumber),
|
||||
SEEK_SET) < 0) {
|
||||
Log ("VGetVnode: can't seek on index file vn=%d\n",vnodeNumber);
|
||||
Log ("VGetVnode: can't seek on index file vn=%u\n",vnodeNumber);
|
||||
*ec = VIO;
|
||||
mlkReason=10;
|
||||
FDH_REALLYCLOSE(fdP);
|
||||
@ -556,7 +558,7 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype)
|
||||
/* Check for disk errors. Anything else just means that the vnode
|
||||
is not allocated */
|
||||
if (n == -1 && errno == EIO) {
|
||||
Log("VGetVnode: Couldn't read vnode %d, volume %u (%s); volume needs salvage\n",
|
||||
Log("VGetVnode: Couldn't read vnode %u, volume %u (%s); volume needs salvage\n",
|
||||
vnodeNumber, V_id(vp), V_name(vp));
|
||||
VForceOffline_r(vp);
|
||||
*ec = VSALVAGE;
|
||||
@ -598,7 +600,7 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype)
|
||||
*ec = VNOVNODE;
|
||||
}
|
||||
else {
|
||||
Log("VGetVnode: Bad magic number, vnode %d, volume %u (%s); volume needs salvage\n",
|
||||
Log("VGetVnode: Bad magic number, vnode %u, volume %u (%s); volume needs salvage\n",
|
||||
vnodeNumber, V_id(vp), V_name(vp));
|
||||
vp->goingOffline = 1; /* used to call VOffline, but that would mess
|
||||
up the volume ref count if called here */
|
||||
@ -747,7 +749,7 @@ VPutVnode_r(ec,vnp)
|
||||
PrintInode(NULL, vp->vnodeIndex[class].handle->ih_ino));
|
||||
*ec = VIO;
|
||||
} else {
|
||||
Log("VPutVnode: Couldn't write vnode %d, volume %u (%s) (error %d)\n",
|
||||
Log("VPutVnode: Couldn't write vnode %u, volume %u (%s) (error %d)\n",
|
||||
vnp->vnodeNumber, V_id(vnp->volumePtr),
|
||||
V_name(vnp->volumePtr), code);
|
||||
VForceOffline_r(vp);
|
||||
@ -879,11 +881,11 @@ int VVnodeWriteToRead_r(ec,vnp)
|
||||
VOL_LOCK
|
||||
if(code == BAD_IGET)
|
||||
{
|
||||
Log("VPutVnode: bad inumber %d\n",
|
||||
vp->vnodeIndex[class].handle->ih_ino);
|
||||
Log("VPutVnode: bad inumber %llu\n",
|
||||
(afs_uintmax_t) vp->vnodeIndex[class].handle->ih_ino);
|
||||
*ec = VIO;
|
||||
} else {
|
||||
Log("VPutVnode: Couldn't write vnode %d, volume %u (%s)\n",
|
||||
Log("VPutVnode: Couldn't write vnode %u, volume %u (%s)\n",
|
||||
vnp->vnodeNumber, V_id(vnp->volumePtr),
|
||||
V_name(vnp->volumePtr));
|
||||
VForceOffline_r(vp);
|
||||
|
@ -470,7 +470,7 @@ void HandleVolume(struct DiskPartition *dp, char *name)
|
||||
if (!dsizeOnly && !saveinodes) {
|
||||
printf("Volume header (size = %d):\n", size = stat.st_size);
|
||||
printf("\tstamp\t= 0x%x\n", header.stamp.version);
|
||||
printf("\tVolId\t= %d\n", header.id);
|
||||
printf("\tVolId\t= %u\n", header.id);
|
||||
}
|
||||
|
||||
IH_INIT(ih, dp->device , header.id, header.volumeInfo);
|
||||
@ -488,7 +488,7 @@ void HandleVolume(struct DiskPartition *dp, char *name)
|
||||
IH_RELEASE(ih);
|
||||
size += code;
|
||||
if (!dsizeOnly && !saveinodes) {
|
||||
printf("\tparent\t= %d\n", header.parent);
|
||||
printf("\tparent\t= %u\n", header.parent);
|
||||
printf("\tInfo inode\t= %s (size = %d)\n",
|
||||
PrintInode(NULL, header.volumeInfo), code);
|
||||
}
|
||||
@ -583,7 +583,7 @@ void HandleVolume(struct DiskPartition *dp, char *name)
|
||||
if (saveinodes)
|
||||
printf("Volume-Id\t Volsize Auxsize Inodesize AVolsize SizeDiff (VolName)\n");
|
||||
|
||||
printf("%d\t%9d%9d%10d%10d%9d\t%24s\n",
|
||||
printf("%u\t%9d%9d%10d%10d%9d\t%24s\n",
|
||||
V_id(vp), Vdiskused, Vauxsize, Vvnodesize, totvolsize,
|
||||
totvolsize-Vdiskused, V_name(vp));
|
||||
}
|
||||
@ -784,8 +784,8 @@ void PrintVnodes(Volume *vp, VnodeClass class)
|
||||
FDH_REALLYCLOSE(fdP1);
|
||||
IH_RELEASE(ih1);
|
||||
close(ofd);
|
||||
printf("... Copied inode %d to file %s (%d bytes)\n",
|
||||
ino, nfile, total);
|
||||
printf("... Copied inode %llu to file %s (%d bytes)\n",
|
||||
(afs_uintmax_t)ino, nfile, total);
|
||||
}
|
||||
} else {
|
||||
#if defined(AFS_NAMEI_ENV)
|
||||
@ -821,8 +821,8 @@ void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber, Inode ino)
|
||||
Vvnodesize += fileLength;
|
||||
if (dsizeOnly) return;
|
||||
if (orphaned && (fileLength ==0 || vnode->parent || !offset)) return;
|
||||
printf("%10d Vnode %u.%u.%u cloned: %d, length: %d linkCount: %d parent: %d",
|
||||
offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, fileLength, vnode->linkCount, vnode->parent);
|
||||
printf("%10d Vnode %u.%u.%u cloned: %d, length: %llu linkCount: %d parent: %u",
|
||||
offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, (afs_uintmax_t)fileLength, vnode->linkCount, vnode->parent);
|
||||
if (DumpInodeNumber)
|
||||
printf(" inode: %s", PrintInode(NULL, ino));
|
||||
if (DumpDate)
|
||||
|
@ -1072,7 +1072,9 @@ void SalvageFileSysParallel(struct DiskPartition *partP)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, jobs[startjob]->jobnumb);
|
||||
(void) afs_snprintf(logFileName, sizeof logFileName, "%s.%d",
|
||||
AFSDIR_SERVER_SLVGLOG_FILEPATH,
|
||||
jobs[startjob]->jobnumb);
|
||||
logFile = fopen(logFileName, "w");
|
||||
}
|
||||
if (!logFile) logFile = stdout;
|
||||
@ -1090,7 +1092,8 @@ void SalvageFileSysParallel(struct DiskPartition *partP)
|
||||
#endif
|
||||
if (!partP) {
|
||||
for (i=0; i<jobcount; i++) {
|
||||
sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
|
||||
(void) afs_snprintf(logFileName, sizeof logFileName, "%s.%d",
|
||||
AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
|
||||
if ((passLog = fopen(logFileName, "r"))) {
|
||||
while(fgets(buf, sizeof(buf), passLog)) {
|
||||
fputs(buf, logFile);
|
||||
@ -1487,7 +1490,8 @@ int GetInodeSummary(char *path, VolumeId singleVolumeNumber)
|
||||
(void) _putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
|
||||
(void) strcpy(summaryFileName, _tempnam(tdir, "salvage.temp"));
|
||||
#else
|
||||
sprintf(summaryFileName, "%s/salvage.temp.%d", tdir, getpid());
|
||||
(void) afs_snprintf(summaryFileName, sizeof summaryFileName,
|
||||
"%s/salvage.temp.%d", tdir, getpid());
|
||||
#endif
|
||||
summaryFile = fopen(summaryFileName, "a+");
|
||||
if (summaryFile == NULL) {
|
||||
@ -1905,9 +1909,10 @@ void DoSalvageVolumeGroup(register struct InodeSummary *isp, int nVols)
|
||||
#endif
|
||||
if (ip->linkCount != 0 && TraceBadLinkCounts) {
|
||||
TraceBadLinkCounts--; /* Limit reports, per volume */
|
||||
Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %u, p=(%u,%u,%u,%u)\n",
|
||||
Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %llu, p=(%u,%u,%u,%u)\n",
|
||||
ip->linkCount, PrintInode(NULL, ip->inodeNumber),
|
||||
ip->byteCount, ip->u.param[0], ip->u.param[1],
|
||||
(afs_uintmax_t) ip->byteCount,
|
||||
ip->u.param[0], ip->u.param[1],
|
||||
ip->u.param[2], ip->u.param[3]);
|
||||
}
|
||||
while (ip->linkCount > 0) {
|
||||
@ -2086,7 +2091,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp,
|
||||
|
||||
if (isp->volSummary == NULL) {
|
||||
char name[64];
|
||||
sprintf(name, VFORMAT, isp->volumeId);
|
||||
(void) afs_snprintf(name, sizeof name, VFORMAT, isp->volumeId);
|
||||
if (check) {
|
||||
Log("No header file for volume %u\n", isp->volumeId);
|
||||
return -1;
|
||||
@ -2111,7 +2116,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp,
|
||||
if (isp->volSummary->fileName) {
|
||||
strcpy(name, isp->volSummary->fileName);
|
||||
} else {
|
||||
sprintf(name, VFORMAT, isp->volumeId);
|
||||
(void) afs_snprintf(name, sizeof name, VFORMAT, isp->volumeId);
|
||||
isp->volSummary->fileName = ToString(name);
|
||||
}
|
||||
|
||||
@ -2485,11 +2490,11 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW,
|
||||
goto zooks;
|
||||
}
|
||||
if (!Showmode) {
|
||||
Log("Vnode %d: inode number incorrect; changed from %s to %s. FileSize=%d\n",
|
||||
Log("Vnode %d: inode number incorrect; changed from %s to %s. FileSize=%llu\n",
|
||||
vnodeNumber,
|
||||
PrintInode(stmp1, VNDISK_GET_INO(vnode)),
|
||||
PrintInode(stmp2, ip->inodeNumber),
|
||||
ip->byteCount);
|
||||
(afs_uintmax_t)ip->byteCount);
|
||||
}
|
||||
VNDISK_SET_INO(vnode, ip->inodeNumber);
|
||||
vnodeChanged = 1;
|
||||
@ -2497,13 +2502,17 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW,
|
||||
VNDISK_GET_LEN(vnodeLength, vnode);
|
||||
if (ip->byteCount != vnodeLength) {
|
||||
if (check) {
|
||||
if (!Showmode) Log("Vnode %d: length incorrect; (is %d should be %d)\n",
|
||||
vnodeNumber, vnodeLength, ip->byteCount);
|
||||
if (!Showmode) Log("Vnode %d: length incorrect; (is %llu should be %llu)\n",
|
||||
vnodeNumber,
|
||||
(afs_uintmax_t)vnodeLength,
|
||||
(afs_uintmax_t)ip->byteCount);
|
||||
err = -1;
|
||||
goto zooks;
|
||||
}
|
||||
if (!Showmode) Log("Vnode %d: length incorrect; changed from %d to %d\n",
|
||||
vnodeNumber, vnodeLength, ip->byteCount);
|
||||
if (!Showmode) Log("Vnode %d: length incorrect; changed from %llu to %llu\n",
|
||||
vnodeNumber,
|
||||
(afs_uintmax_t)vnodeLength,
|
||||
(afs_uintmax_t)ip->byteCount);
|
||||
VNDISK_SET_LEN(vnode, ip->byteCount);
|
||||
vnodeChanged = 1;
|
||||
}
|
||||
@ -2716,7 +2725,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
vnodeEssence = CheckVnodeNumber(vnodeNumber);
|
||||
if (vnodeEssence == NULL) {
|
||||
if (!Showmode) {
|
||||
Log("dir vnode %d: invalid entry deleted: %s/%s (vnode %d, unique %d)\n",
|
||||
Log("dir vnode %u: invalid entry deleted: %s/%s (vnode %u, unique %u)\n",
|
||||
dir->vnodeNumber, dir->name?dir->name:"??",
|
||||
name, vnodeNumber, unique);
|
||||
}
|
||||
@ -2749,7 +2758,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
|
||||
if (!(vnodeNumber & 1) && !Showmode &&
|
||||
!(vnodeEssence->count || vnodeEssence->unique || vnodeEssence->modeBits)) {
|
||||
Log("dir vnode %d: invalid entry: %s/%s (vnode %d, unique %d)%s\n",
|
||||
Log("dir vnode %u: invalid entry: %s/%s (vnode %u, unique %u)%s\n",
|
||||
dir->vnodeNumber, (dir->name?dir->name:"??"),
|
||||
name, vnodeNumber, unique,
|
||||
((!unique)?(Testing?"-- would have deleted":" -- deleted"):""));
|
||||
@ -2780,7 +2789,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
todelete = ((!vnodeEssence->unique || dirOrphaned) ? 1 : 0);
|
||||
|
||||
if (!Showmode) {
|
||||
Log("dir vnode %d: %s/%s (vnode %d): unique changed from %d to %d %s\n",
|
||||
Log("dir vnode %u: %s/%s (vnode %u): unique changed from %u to %u %s\n",
|
||||
dir->vnodeNumber, (dir->name ? dir->name : "??"),
|
||||
name, vnodeNumber, unique, vnodeEssence->unique,
|
||||
(!todelete?"":(Testing?"-- would have deleted":"-- deleted")));
|
||||
@ -2800,7 +2809,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
if (strcmp(name,".") == 0) {
|
||||
if (dir->vnodeNumber != vnodeNumber || (dir->unique != unique)) {
|
||||
ViceFid fid;
|
||||
if (!Showmode) Log("directory vnode %d.%d: bad '.' entry (was %d.%d); fixed\n",
|
||||
if (!Showmode) Log("directory vnode %u.%u: bad '.' entry (was %u.%u); fixed\n",
|
||||
dir->vnodeNumber, dir->unique, vnodeNumber, unique);
|
||||
if (!Testing) {
|
||||
CopyOnWrite(dir);
|
||||
@ -2830,7 +2839,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
pa.Unique = dir->unique;
|
||||
}
|
||||
if ((pa.Vnode != vnodeNumber) || (pa.Unique != unique)) {
|
||||
if (!Showmode) Log("directory vnode %d.%d: bad '..' entry (was %d.%d); fixed\n",
|
||||
if (!Showmode) Log("directory vnode %u.%u: bad '..' entry (was %u.%u); fixed\n",
|
||||
dir->vnodeNumber, dir->unique, vnodeNumber, unique);
|
||||
if (!Testing) {
|
||||
CopyOnWrite(dir);
|
||||
@ -2845,7 +2854,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
dir->haveDotDot = 1;
|
||||
} else if (strncmp(name,".__afs",6) == 0) {
|
||||
if (!Showmode) {
|
||||
Log("dir vnode %d: special old unlink-while-referenced file %s %s deleted (vnode %d)\n",
|
||||
Log("dir vnode %u: special old unlink-while-referenced file %s %s deleted (vnode %u)\n",
|
||||
dir->vnodeNumber, name, (Testing?"would have been":"is"), vnodeNumber);
|
||||
}
|
||||
if (!Testing) {
|
||||
@ -2893,7 +2902,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
if (vnodeIdToClass(vnodeNumber) == vLarge &&
|
||||
vnodeEssence->name == NULL) {
|
||||
char *n;
|
||||
if (n = (char*)malloc(strlen(name)+1))
|
||||
if ((n = (char*)malloc(strlen(name)+1)))
|
||||
strcpy(n, name);
|
||||
vnodeEssence->name = n;
|
||||
}
|
||||
@ -2912,7 +2921,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
* another non-orphaned dir).
|
||||
*/
|
||||
if (!Showmode) {
|
||||
Log("dir vnode %d: %s/%s (vnode %d, unique %d) -- parent vnode %schanged from %d to %d\n",
|
||||
Log("dir vnode %u: %s/%s (vnode %u, unique %u) -- parent vnode %schanged from %u to %u\n",
|
||||
dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
|
||||
vnodeNumber, unique, (Testing?"would have been ":""),
|
||||
vnodeEssence->parent, dir->vnodeNumber);
|
||||
@ -2923,12 +2932,12 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
|
||||
/* Vnode was claimed by another directory */
|
||||
if (!Showmode) {
|
||||
if (dirOrphaned) {
|
||||
Log("dir vnode %d: %s/%s parent vnode is %d (vnode %d, unique %d) -- %sdeleted\n",
|
||||
Log("dir vnode %u: %s/%s parent vnode is %u (vnode %u, unique %u) -- %sdeleted\n",
|
||||
dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
|
||||
vnodeEssence->parent, vnodeNumber, unique,
|
||||
(Testing?"would have been ":""));
|
||||
} else {
|
||||
Log("dir vnode %d: %s/%s already claimed by directory vnode %d (vnode %d, unique %d) -- %sdeleted\n",
|
||||
Log("dir vnode %u: %s/%s already claimed by directory vnode %u (vnode %u, unique %u) -- %sdeleted\n",
|
||||
dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
|
||||
vnodeEssence->parent, vnodeNumber, unique,
|
||||
(Testing?"would have been ":""));
|
||||
@ -3085,7 +3094,7 @@ void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo,
|
||||
dirok = ((RebuildDirs && !Testing) ? 0 : DirOK(&dir.dirHandle));
|
||||
if (!dirok) {
|
||||
if (!RebuildDirs) {
|
||||
Log("Directory bad, vnode %d; %s...\n",
|
||||
Log("Directory bad, vnode %u; %s...\n",
|
||||
dir.vnodeNumber, (Testing ? "skipping" : "salvaging"));
|
||||
}
|
||||
if (!Testing) {
|
||||
@ -3249,7 +3258,7 @@ int SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t *alinkH)
|
||||
pa.Vnode = ThisVnode;
|
||||
pa.Unique = ThisUnique;
|
||||
|
||||
sprintf(npath, "%s.%d.%d",
|
||||
(void) afs_snprintf(npath, sizeof npath, "%s.%u.%u",
|
||||
((class == vLarge)?"__ORPHANDIR__":"__ORPHANFILE__"),
|
||||
ThisVnode, ThisUnique);
|
||||
|
||||
@ -3334,7 +3343,7 @@ int SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t *alinkH)
|
||||
}
|
||||
} else if (vnp->count) {
|
||||
if (!Showmode) {
|
||||
Log("Vnode %d: link count incorrect (was %d, %s %d)\n",
|
||||
Log("Vnode %u: link count incorrect (was %d, %s %d)\n",
|
||||
vnodeNumber, oldCount,
|
||||
(Testing?"would have changed to":"now"), vnode.linkCount);
|
||||
}
|
||||
@ -3505,8 +3514,9 @@ void PrintInodeList(void)
|
||||
nInodes = status.st_size / sizeof(struct ViceInodeInfo);
|
||||
assert(read(inodeFd, buf, status.st_size) == status.st_size);
|
||||
for(ip = buf; nInodes--; ip++) {
|
||||
Log("Inode:%s, linkCount=%d, size=%u, p=(%u,%u,%u,%u)\n",
|
||||
PrintInode(NULL, ip->inodeNumber), ip->linkCount, ip->byteCount,
|
||||
Log("Inode:%s, linkCount=%d, size=%#llx, p=(%u,%u,%u,%u)\n",
|
||||
PrintInode(NULL, ip->inodeNumber), ip->linkCount,
|
||||
(afs_uintmax_t) ip->byteCount,
|
||||
ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]);
|
||||
}
|
||||
free(buf);
|
||||
@ -3623,10 +3633,11 @@ void TimeStampLogFile(void)
|
||||
|
||||
now = time(0);
|
||||
lt = localtime(&now);
|
||||
sprintf(stampSlvgLog, "%s.%04d-%02d-%02d.%02d:%02d:%02d",
|
||||
AFSDIR_SERVER_SLVGLOG_FILEPATH,
|
||||
lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday,
|
||||
lt->tm_hour, lt->tm_min, lt->tm_sec);
|
||||
(void) afs_snprintf(stampSlvgLog, sizeof stampSlvgLog,
|
||||
"%s.%04d-%02d-%02d.%02d:%02d:%02d",
|
||||
AFSDIR_SERVER_SLVGLOG_FILEPATH,
|
||||
lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday,
|
||||
lt->tm_hour, lt->tm_min, lt->tm_sec);
|
||||
|
||||
/* try to link the logfile to a timestamped filename */
|
||||
/* if it fails, oh well, nothing we can do */
|
||||
@ -3664,45 +3675,44 @@ void showlog(void)
|
||||
void Log(const char *format, ...)
|
||||
{
|
||||
struct timeval now;
|
||||
char tmp[1024];
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
(void) afs_vsnprintf(tmp, sizeof tmp, format, args);
|
||||
va_end(args);
|
||||
#ifndef AFS_NT40_ENV
|
||||
if ( useSyslog )
|
||||
{
|
||||
char tmp[1024];
|
||||
(void) vsnprintf(tmp, sizeof tmp, format, args);
|
||||
syslog(LOG_INFO, "%s", tmp);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
gettimeofday(&now, 0);
|
||||
fprintf(logFile, "%s ", TimeStamp(now.tv_sec, 1));
|
||||
vfprintf(logFile, format, args);
|
||||
fprintf(logFile, "%s %s", TimeStamp(now.tv_sec, 1), tmp);
|
||||
fflush(logFile);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Abort(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char tmp[1024];
|
||||
|
||||
va_start(args, format);
|
||||
(void) afs_vsnprintf(tmp, sizeof tmp, format, args);
|
||||
va_end(args);
|
||||
#ifndef AFS_NT40_ENV
|
||||
if ( useSyslog )
|
||||
{
|
||||
char tmp[1024];
|
||||
(void) vsnprintf(tmp, sizeof tmp, format, args);
|
||||
syslog(LOG_INFO, "%s", tmp);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
vfprintf(logFile, format, args);
|
||||
fprintf(logFile, "%s", tmp);
|
||||
fflush(logFile);
|
||||
if (ShowLog) showlog();
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
if (debug)
|
||||
abort();
|
||||
|
@ -116,8 +116,8 @@ RCSID("$Header$");
|
||||
#include "lwp.h"
|
||||
#include <afs/afssyscalls.h>
|
||||
#include "ihandle.h"
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <afs/afsutil.h>
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "vnode.h"
|
||||
@ -286,10 +286,10 @@ int VInitVolumePackage(ProgramType pt, int nLargeVnodes, int nSmallVnodes,
|
||||
V_VOLUPD);
|
||||
(*(vp?&nAttached:&nUnattached))++;
|
||||
if (error == VOFFLINE)
|
||||
Log("Volume %u stays offline (/vice/offline/%s exists)\n",
|
||||
Log("Volume %d stays offline (/vice/offline/%s exists)\n",
|
||||
VolumeNumber(dp->d_name), dp->d_name);
|
||||
else
|
||||
Log("Partition %s: attached volume %u (%s)\n", diskP->name,
|
||||
Log("Partition %s: attached volume %d (%s)\n", diskP->name,
|
||||
VolumeNumber(dp->d_name), dp->d_name);
|
||||
if (vp) {
|
||||
VPutVolume(vp);
|
||||
@ -710,7 +710,7 @@ private Volume *attach2(Error *ec, char *path, register struct VolumeHeader
|
||||
VOLUMEINFOMAGIC, VOLUMEINFOVERSION);
|
||||
VOL_LOCK
|
||||
if (*ec) {
|
||||
Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%d\n",
|
||||
Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%u\n",
|
||||
path, *ec);
|
||||
}
|
||||
if (!*ec) {
|
||||
@ -733,7 +733,7 @@ private Volume *attach2(Error *ec, char *path, register struct VolumeHeader
|
||||
SMALLINDEXMAGIC, SMALLINDEXVERSION);
|
||||
VOL_LOCK
|
||||
if (*ec) {
|
||||
Log("VAttachVolume: Error reading smallVnode vol header %s; error=%d\n",
|
||||
Log("VAttachVolume: Error reading smallVnode vol header %s; error=%u\n",
|
||||
path, *ec);
|
||||
}
|
||||
}
|
||||
@ -745,7 +745,7 @@ private Volume *attach2(Error *ec, char *path, register struct VolumeHeader
|
||||
LARGEINDEXMAGIC, LARGEINDEXVERSION);
|
||||
VOL_LOCK
|
||||
if (*ec) {
|
||||
Log("VAttachVolume: Error reading largeVnode vol header %s; error=%d\n",
|
||||
Log("VAttachVolume: Error reading largeVnode vol header %s; error=%u\n",
|
||||
path, *ec);
|
||||
}
|
||||
}
|
||||
@ -758,13 +758,13 @@ private Volume *attach2(Error *ec, char *path, register struct VolumeHeader
|
||||
LINKTABLEMAGIC, LINKTABLEVERSION);
|
||||
VOL_LOCK
|
||||
if (*ec) {
|
||||
Log("VAttachVolume: Error reading namei vol header %s; error=%d\n",
|
||||
Log("VAttachVolume: Error reading namei vol header %s; error=%u\n",
|
||||
path, *ec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (*ec) {
|
||||
Log("VAttachVolume: Error attaching volume %s; volume needs salvage; error=%d\n",
|
||||
Log("VAttachVolume: Error attaching volume %s; volume needs salvage; error=%u\n",
|
||||
path, *ec);
|
||||
FreeVolume(vp);
|
||||
return NULL;
|
||||
|
@ -45,6 +45,7 @@ RCSID("$Header$");
|
||||
#include "lwp.h"
|
||||
#include <afs/afssyscalls.h>
|
||||
#include "ihandle.h"
|
||||
#include <afs/afsutil.h>
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include "ntops.h"
|
||||
#include <io.h>
|
||||
@ -64,6 +65,7 @@ RCSID("$Header$");
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*@printflike@*/ extern void Log(const char *format, ...);
|
||||
|
||||
void AssignVolumeName();
|
||||
@ -156,8 +158,9 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId)
|
||||
vol.stamp.magic = VOLUMEINFOMAGIC;
|
||||
vol.stamp.version = VOLUMEINFOVERSION;
|
||||
vol.destroyMe = DESTROY_ME;
|
||||
sprintf(headerName, VFORMAT, vol.id);
|
||||
sprintf(volumePath, "%s/%s", VPartitionPath(partition), headerName);
|
||||
(void) afs_snprintf(headerName, sizeof headerName, VFORMAT, vol.id);
|
||||
(void) afs_snprintf(volumePath, sizeof volumePath,
|
||||
"%s/%s", VPartitionPath(partition), headerName);
|
||||
fd = open(volumePath, O_CREAT|O_EXCL|O_WRONLY, 0600);
|
||||
if (fd == -1) {
|
||||
if (errno == EEXIST) {
|
||||
@ -251,18 +254,21 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId)
|
||||
IH_INIT(handle, device, vol.parentId, tempHeader.volumeInfo);
|
||||
fdP = IH_OPEN(handle);
|
||||
if (fdP == NULL) {
|
||||
Log("VCreateVolume: Problem iopen inode %d (err=%d)\n", tempHeader.volumeInfo, errno);
|
||||
Log("VCreateVolume: Problem iopen inode %llu (err=%d)\n",
|
||||
(afs_uintmax_t)tempHeader.volumeInfo, errno);
|
||||
unlink(volumePath);
|
||||
goto bad;
|
||||
}
|
||||
if (FDH_SEEK(fdP, 0, SEEK_SET) < 0) {
|
||||
Log("VCreateVolume: Problem lseek inode %d (err=%d)\n", tempHeader.volumeInfo, errno);
|
||||
Log("VCreateVolume: Problem lseek inode %llu (err=%d)\n",
|
||||
(afs_uintmax_t)tempHeader.volumeInfo, errno);
|
||||
FDH_REALLYCLOSE(fdP);
|
||||
unlink(volumePath);
|
||||
goto bad;
|
||||
}
|
||||
if (FDH_WRITE(fdP, (char*)&vol, sizeof(vol)) != sizeof(vol)) {
|
||||
Log("VCreateVolume: Problem writing to inode %d (err=%d)\n", tempHeader.volumeInfo, errno);
|
||||
Log("VCreateVolume: Problem writing to inode %llu (err=%d)\n",
|
||||
(afs_uintmax_t)tempHeader.volumeInfo, errno);
|
||||
FDH_REALLYCLOSE(fdP);
|
||||
unlink(volumePath);
|
||||
goto bad;
|
||||
|
@ -181,7 +181,7 @@ dest: \
|
||||
|
||||
splint::
|
||||
splint $(CFLAGS) \
|
||||
vos.c \
|
||||
vos.c restorevol.c \
|
||||
vsprocs.c vsutils.c lockprocs.c volerr.c \
|
||||
volmain.c volprocs.c physio.c common.c voltrans.c volerr.c \
|
||||
volmain.c volprocs.c physio.c common.c voltrans.c \
|
||||
dumpstuff.c
|
||||
|
@ -735,8 +735,8 @@ static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
|
||||
IH_INIT(ihP, iodp->device, iodp->parentId, VNDISK_GET_INO(v));
|
||||
fdP = IH_OPEN(ihP);
|
||||
if (fdP == NULL) {
|
||||
Log("1 Volser: DumpVnode: dump: Unable to open inode %d for vnode %d (volume %d); not dumped, error %d\n",
|
||||
VNDISK_GET_INO(v), vnodeNumber, volid, errno);
|
||||
Log("1 Volser: DumpVnode: dump: Unable to open inode %llu for vnode %u (volume %i); not dumped, error %d\n",
|
||||
(afs_uintmax_t)VNDISK_GET_INO(v), vnodeNumber, volid, errno);
|
||||
IH_RELEASE(ihP);
|
||||
return VOLSERREAD_DUMPERROR;
|
||||
}
|
||||
@ -779,9 +779,10 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep,
|
||||
cnt1++;
|
||||
if (DoLogging) {
|
||||
afs_fsize_t vnodeLength;
|
||||
Log("RestoreVolume %d Cleanup: Removing old vnode=%d inode=%d size=%d\n",
|
||||
Log("RestoreVolume %u Cleanup: Removing old vnode=%u inode=%llu size=%llu\n",
|
||||
V_id(vp), bitNumberToVnodeNumber(i,class),
|
||||
VNDISK_GET_INO(vnode), vnodeLength);
|
||||
(afs_uintmax_t)VNDISK_GET_INO(vnode),
|
||||
(afs_uintmax_t)vnodeLength);
|
||||
}
|
||||
IH_DEC(V_linkHandle(vp), VNDISK_GET_INO(vnode),
|
||||
V_parentId(vp));
|
||||
@ -1021,7 +1022,8 @@ static int ReadVnodes(register struct iod *iodp, Volume *vp,
|
||||
FDH_REALLYCLOSE(fdP);
|
||||
IH_RELEASE(tmpH);
|
||||
if (error) {
|
||||
Log("1 Volser: ReadVnodes: IDEC inode %d\n", ino);
|
||||
Log("1 Volser: ReadVnodes: IDEC inode %llu\n",
|
||||
(afs_uintmax_t)ino);
|
||||
IH_DEC(V_linkHandle(vp), ino, V_parentId(vp));
|
||||
return VOLSERREAD_DUMPERROR;
|
||||
}
|
||||
@ -1111,7 +1113,7 @@ static bit32 volser_WriteFile(int vn, struct iod *iodp, FdHandle_t *handleP,
|
||||
size = nbytes;
|
||||
|
||||
if ((code = iod_Read(iodp, p, size)) != size) {
|
||||
Log("1 Volser: WriteFile: Error reading dump file %d size=%d nbytes=%d (%d of %d); restore aborted\n", vn, filesize, nbytes, code, size);
|
||||
Log("1 Volser: WriteFile: Error reading dump file %d size=%llu nbytes=%u (%d of %u); restore aborted\n", vn, (afs_uintmax_t)filesize, nbytes, code, size);
|
||||
*status = 3;
|
||||
break;
|
||||
}
|
||||
|
@ -469,16 +469,18 @@ afs_int32 ReadVNode(count)
|
||||
*/
|
||||
vnode = ((vn.type == 2) ? vn.vnode : vn.parent);
|
||||
if (vnode == 1)
|
||||
sprintf(parentdir, "%s", rootdir);
|
||||
strncpy(parentdir, rootdir, sizeof parentdir);
|
||||
else {
|
||||
sprintf(parentdir, "%s/%s%d", rootdir, ADIR, vnode);
|
||||
afs_snprintf(parentdir, sizeof parentdir,
|
||||
"%s/%s%d", rootdir, ADIR, vnode);
|
||||
|
||||
len = readlink(parentdir, linkname, MAXNAMELEN);
|
||||
if (len < 0) {
|
||||
/* parentdir does not exist. So create an orphan dir.
|
||||
* and then link the parentdir to the orphaned dir.
|
||||
*/
|
||||
sprintf(linkname, "%s/%s%d", rootdir, ODIR, vnode);
|
||||
afs_snprintf(linkname, sizeof linkname,
|
||||
"%s/%s%d", rootdir, ODIR, vnode);
|
||||
code = mkdir(linkname, 0777);
|
||||
if ((code < 0) && (errno != EEXIST)) {
|
||||
fprintf(stderr, "Error creating directory %s code=%d;%d\n",
|
||||
@ -486,7 +488,8 @@ afs_int32 ReadVNode(count)
|
||||
}
|
||||
|
||||
/* Link the parentdir to it - now parentdir exists */
|
||||
sprintf(linkname, "%s%d/", ODIR, vnode);
|
||||
afs_snprintf(linkname, sizeof linkname,
|
||||
"%s%d/", ODIR, vnode);
|
||||
code = symlink(linkname, parentdir);
|
||||
if (code) {
|
||||
fprintf(stderr, "Error creating symlink %s -> %s code=%d;%d\n",
|
||||
@ -571,8 +574,10 @@ afs_int32 ReadVNode(count)
|
||||
/* dirname is the directory to create.
|
||||
* vflink is what will link to it.
|
||||
*/
|
||||
sprintf(dirname, "%s/%s", parentdir, this_name);
|
||||
sprintf(vflink, "%s/%s%d", rootdir, ADIR, this_vn);
|
||||
afs_snprintf(dirname, sizeof dirname,
|
||||
"%s/%s", parentdir, this_name);
|
||||
afs_snprintf(vflink, sizeof vflink,
|
||||
"%s/%s%d", rootdir, ADIR, this_vn);
|
||||
|
||||
/* The link and directory may already exist */
|
||||
len = readlink(vflink, linkname, MAXNAMELEN);
|
||||
@ -590,7 +595,8 @@ afs_int32 ReadVNode(count)
|
||||
* It was created originally as orphaned.
|
||||
*/
|
||||
linkname[len-1] = '\0'; /* remove '/' at end */
|
||||
sprintf(lname, "%s/%s", rootdir, linkname);
|
||||
afs_snprintf(lname, sizeof lname,
|
||||
"%s/%s", rootdir, linkname);
|
||||
code = rename(lname, dirname);
|
||||
if (code) {
|
||||
fprintf(stderr, "Error renaming %s to %s code=%d;%d\n",
|
||||
@ -600,9 +606,11 @@ afs_int32 ReadVNode(count)
|
||||
|
||||
/* Now create/update the link to the new/moved directory */
|
||||
if (vn.vnode == 1)
|
||||
sprintf(dirname, "%s/", this_name);
|
||||
afs_snprintf(dirname, sizeof dirname,
|
||||
"%s/", this_name);
|
||||
else
|
||||
sprintf(dirname, "%s%d/%s/", ADIR, vn.vnode, this_name);
|
||||
afs_snprintf(dirname, sizeof dirname,
|
||||
"%s%d/%s/", ADIR, vn.vnode, this_name);
|
||||
unlink(vflink);
|
||||
code = symlink(dirname, vflink);
|
||||
if (code) {
|
||||
@ -617,7 +625,8 @@ afs_int32 ReadVNode(count)
|
||||
*/
|
||||
else {
|
||||
/*AFILEENTRY*/
|
||||
sprintf(vflink, "%s/%s%d", parentdir, AFILE, this_vn);
|
||||
afs_snprintf(vflink, sizeof vflink,
|
||||
"%s/%s%d", parentdir, AFILE, this_vn);
|
||||
|
||||
code = symlink(this_name, vflink);
|
||||
if ((code < 0) && (errno != EEXIST)) {
|
||||
@ -643,10 +652,12 @@ afs_int32 ReadVNode(count)
|
||||
* then the file will be an orphaned file.
|
||||
*/
|
||||
lfile = 1;
|
||||
sprintf(filename, "%s/%s%d", parentdir, AFILE, vn.vnode);
|
||||
afs_snprintf(filename, sizeof filename,
|
||||
"%s/%s%d", parentdir, AFILE, vn.vnode);
|
||||
len = readlink(filename, fname, MAXNAMELEN);
|
||||
if (len < 0) {
|
||||
sprintf(filename, "%s/%s%d", rootdir, OFILE, vn.vnode);
|
||||
afs_snprintf(filename, sizeof filename,
|
||||
"%s/%s%d", rootdir, OFILE, vn.vnode);
|
||||
lfile = 0; /* no longer a linked file; a direct path */
|
||||
}
|
||||
|
||||
@ -664,15 +675,20 @@ afs_int32 ReadVNode(count)
|
||||
s = ((size > BUFSIZE) ? BUFSIZE : size);
|
||||
code = fread(buf, 1, s, dumpfile);
|
||||
if (code > 0) {
|
||||
write(fid, buf, code);
|
||||
(void) write(fid, buf, code);
|
||||
size -= code;
|
||||
}
|
||||
if (code != s) {
|
||||
if (code < 0)
|
||||
fprintf (stderr, "Code = %d; Errno = %d\n", code, errno);
|
||||
else
|
||||
fprintf (stderr, "Read %d bytes out of %d\n",
|
||||
(vn.dataSize - size), vn.dataSize);
|
||||
else {
|
||||
char tmp[100];
|
||||
(void) afs_snprintf(tmp, sizeof tmp,
|
||||
"Read %llu bytes out of %llu",
|
||||
(afs_uintmax_t)(vn.dataSize - size),
|
||||
(afs_uintmax_t)vn.dataSize);
|
||||
fprintf (stderr, "%s\n", tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -700,13 +716,16 @@ afs_int32 ReadVNode(count)
|
||||
* of the symbolic link. If it doesn't exist,
|
||||
* then the link will be an orphaned link.
|
||||
*/
|
||||
sprintf(linkname, "%s/%s%d", parentdir, AFILE, vn.vnode);
|
||||
afs_snprintf(linkname, sizeof linkname,
|
||||
"%s/%s%d", parentdir, AFILE, vn.vnode);
|
||||
len = readlink(linkname, fname, MAXNAMELEN);
|
||||
if (len < 0) {
|
||||
sprintf(filename, "%s/%s%d", rootdir, OFILE, vn.vnode);
|
||||
afs_snprintf(filename, sizeof filename,
|
||||
"%s/%s%d", rootdir, OFILE, vn.vnode);
|
||||
} else {
|
||||
fname[len] = '\0';
|
||||
sprintf(filename, "%s/%s", parentdir, fname);
|
||||
afs_snprintf(filename, sizeof filename,
|
||||
"%s/%s", parentdir, fname);
|
||||
}
|
||||
|
||||
/* Read the link in, delete it, and then create it */
|
||||
@ -821,7 +840,7 @@ WorkerBee(as, arock)
|
||||
code = chdir((as->parms[3].items ? as->parms[3].items->data :
|
||||
as->parms[1].items->data));
|
||||
if (code) {
|
||||
fprintf(stderr, "Mount point directory not found: Error = %d\n", stderr);
|
||||
fprintf(stderr, "Mount point directory not found: Error = %d\n", errno);
|
||||
goto cleanup;
|
||||
}
|
||||
t = (char *)getcwd(mntroot, MAXPATHLEN); /* get its full pathname */
|
||||
@ -832,9 +851,9 @@ WorkerBee(as, arock)
|
||||
goto cleanup;
|
||||
}
|
||||
strcat(mntroot, "/"); /* append '/' to end of it */
|
||||
chdir(thisdir); /* return to original working dir */
|
||||
code = chdir(thisdir); /* return to original working dir */
|
||||
if (code) {
|
||||
fprintf(stderr, "Cannot find working directory: Error = %d\n", stderr);
|
||||
fprintf(stderr, "Cannot find working directory: Error = %d\n", errno);
|
||||
goto cleanup;
|
||||
}
|
||||
} else { /* use current directory */
|
||||
@ -885,17 +904,18 @@ WorkerBee(as, arock)
|
||||
dirP = opendir(rootdir);
|
||||
while (dirP && (dirE = readdir(dirP))) {
|
||||
if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
|
||||
sprintf(name, "%s/%s", rootdir, dirE->d_name);
|
||||
afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
|
||||
dirQ = opendir(name);
|
||||
while (dirQ && (dirF = readdir(dirQ))) {
|
||||
if (strncmp(dirF->d_name, AFILE, strlen(AFILE)) == 0) {
|
||||
sprintf(name, "%s/%s/%s", rootdir, dirE->d_name, dirF->d_name);
|
||||
afs_snprintf(name, sizeof name,
|
||||
"%s/%s/%s", rootdir, dirE->d_name, dirF->d_name);
|
||||
unlink(name);
|
||||
}
|
||||
}
|
||||
closedir(dirQ);
|
||||
} else if (strncmp(dirE->d_name, AFILE, strlen(AFILE)) == 0) {
|
||||
sprintf(name, "%s/%s", rootdir, dirE->d_name);
|
||||
afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
|
||||
unlink(name);
|
||||
}
|
||||
}
|
||||
@ -906,7 +926,7 @@ WorkerBee(as, arock)
|
||||
dirP = opendir(rootdir);
|
||||
while (dirP && (dirE = readdir(dirP))) {
|
||||
if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
|
||||
sprintf(name, "%s/%s", rootdir, dirE->d_name);
|
||||
afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
|
||||
unlink(name);
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ char *aname;
|
||||
afs_int32 asize; {
|
||||
if (asize < 18) return -1;
|
||||
/* It's better using the Generic VFORMAT since otherwise we have to make changes to too many places... The 14 char limitation in names hits us again in AIX; print in field of 9 digits (still 10 for the rest), right justified with 0 padding */
|
||||
sprintf(aname, VFORMAT, (unsigned long) avol);
|
||||
(void) afs_snprintf(aname, asize, VFORMAT, (unsigned long) avol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ char *newName;
|
||||
CloneVolume(&error, originalvp, newvp, purgevp);
|
||||
purgevp = NULL; /* clone releases it, maybe even if error */
|
||||
if (error) {
|
||||
Log("1 Volser: Clone: clone operation failed with code %d\n", error);
|
||||
Log("1 Volser: Clone: clone operation failed with code %u\n", error);
|
||||
LogError(error);
|
||||
goto fail;
|
||||
}
|
||||
@ -646,7 +646,7 @@ char *newName;
|
||||
V_inUse(newvp) = 0;
|
||||
VUpdateVolume(&error, newvp);
|
||||
if (error) {
|
||||
Log("1 Volser: Clone: VUpdate failed code %d\n", error);
|
||||
Log("1 Volser: Clone: VUpdate failed code %u\n", error);
|
||||
LogError(error);
|
||||
goto fail;
|
||||
}
|
||||
@ -654,7 +654,7 @@ char *newName;
|
||||
newvp = NULL;
|
||||
VUpdateVolume(&error, originalvp);
|
||||
if (error) {
|
||||
Log("1 Volser: Clone: original update %d\n", error);
|
||||
Log("1 Volser: Clone: original update %u\n", error);
|
||||
LogError(error);
|
||||
goto fail;
|
||||
}
|
||||
@ -803,7 +803,7 @@ afs_int32 cloneId;
|
||||
V_inUse(clonevp) = 0;
|
||||
VUpdateVolume(&error, clonevp);
|
||||
if (error) {
|
||||
Log("1 Volser: Clone: VUpdate failed code %d\n", error);
|
||||
Log("1 Volser: Clone: VUpdate failed code %u\n", error);
|
||||
LogError(error);
|
||||
goto fail;
|
||||
}
|
||||
@ -811,7 +811,7 @@ afs_int32 cloneId;
|
||||
clonevp = NULL;
|
||||
VUpdateVolume(&error, originalvp);
|
||||
if (error) {
|
||||
Log("1 Volser: Clone: original update %d\n", error);
|
||||
Log("1 Volser: Clone: original update %u\n", error);
|
||||
LogError(error);
|
||||
goto fail;
|
||||
}
|
||||
@ -2746,8 +2746,8 @@ afs_int32 SAFSVolConvertROtoRWvolume(acid, partId, volumeId)
|
||||
}
|
||||
}
|
||||
if (!found) return ENOENT;
|
||||
sprintf(headername, VFORMAT, volumeId);
|
||||
sprintf(opath,"%s/%s", pname, headername);
|
||||
(void) afs_snprintf(headername, sizeof headername, VFORMAT, volumeId);
|
||||
(void) afs_snprintf(opath, sizeof opath,"%s/%s", pname, headername);
|
||||
fd = open(opath, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
Log("1 SAFS_VolConvertROtoRWvolume: Couldn't open header for RO-volume %lu.\n", volumeId);
|
||||
@ -2777,8 +2777,8 @@ afs_int32 SAFSVolConvertROtoRWvolume(acid, partId, volumeId)
|
||||
h.smallVnodeIndex_hi = h.id;
|
||||
h.largeVnodeIndex_hi = h.id;
|
||||
h.linkTable_hi = h.id;
|
||||
sprintf(headername, VFORMAT, h.id);
|
||||
sprintf(npath, "%s/%s", pname, headername);
|
||||
(void) afs_snprintf(headername, sizeof headername, VFORMAT, h.id);
|
||||
(void) afs_snprintf(npath, sizeof npath, "%s/%s", pname, headername);
|
||||
fd = open(npath, O_CREAT | O_EXCL | O_RDWR, 0644);
|
||||
if (fd < 0) {
|
||||
Log("1 SAFS_VolConvertROtoRWvolume: Couldn't create header for RW-volume %lu.\n", h.id);
|
||||
|
@ -874,7 +874,7 @@ void sigint_handler(int x)
|
||||
fflush(STDOUT);
|
||||
|
||||
interrupt=1;
|
||||
signal(SIGINT,sigint_handler);
|
||||
(void) signal(SIGINT,sigint_handler);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user