Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 342101
Collapse All | Expand All

(-)a/acinclude.m4 (-1 / +17 lines)
Lines 348-354 case $system in Link Here
348
		MKAFS_OSTYPE=NBSD
348
		MKAFS_OSTYPE=NBSD
349
		AC_MSG_RESULT(nbsd)
349
		AC_MSG_RESULT(nbsd)
350
		;;
350
		;;
351
	*-openbsd*)
351
	x86_64-*-openbsd*)
352
		MKAFS_OSTYPE=OBSD
353
		AC_MSG_RESULT(amd64_obsd)
354
		;;
355
	i386-*-openbsd*)
352
		MKAFS_OSTYPE=OBSD
356
		MKAFS_OSTYPE=OBSD
353
		AC_MSG_RESULT(i386_obsd)
357
		AC_MSG_RESULT(i386_obsd)
354
		;;
358
		;;
Lines 372-377 else Link Here
372
			vm=${v#*.}
376
			vm=${v#*.}
373
			AFS_SYSNAME="i386_obsd${vM}${vm}"
377
			AFS_SYSNAME="i386_obsd${vM}${vm}"
374
			;;
378
			;;
379
		x86_64-*-openbsd?.?)
380
			v=${host#*openbsd}
381
			vM=${v%.*}
382
			vm=${v#*.}
383
			AFS_SYSNAME="amd64_obsd${vM}${vm}"
384
			;;
375
		i?86-*-freebsd?.*)
385
		i?86-*-freebsd?.*)
376
			v=${host#*freebsd}
386
			v=${host#*freebsd}
377
			vM=${v%.*}
387
			vM=${v%.*}
Lines 747-752 case $AFS_SYSNAME in *_linux* | *_umlinux*) Link Here
747
		 LINUX_DEFINES_FOR_EACH_PROCESS
757
		 LINUX_DEFINES_FOR_EACH_PROCESS
748
		 LINUX_DEFINES_PREV_TASK
758
		 LINUX_DEFINES_PREV_TASK
749
		 LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE
759
		 LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE
760
		 LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE
750
		 LINUX_FS_STRUCT_SUPER_BLOCK_HAS_S_BDI
761
		 LINUX_FS_STRUCT_SUPER_BLOCK_HAS_S_BDI
751
		 LINUX_STRUCT_BDI_HAS_NAME
762
		 LINUX_STRUCT_BDI_HAS_NAME
752
	         LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
763
	         LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
Lines 771-776 case $AFS_SYSNAME in *_linux* | *_umlinux*) Link Here
771
	  	 LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
782
	  	 LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
772
	  	 LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
783
	  	 LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
773
	  	 LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
784
	  	 LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
785
		 LINUX_FOP_F_FSYNC_TAKES_DENTRY
774
	  	 LINUX_AOP_WRITEBACK_CONTROL
786
	  	 LINUX_AOP_WRITEBACK_CONTROL
775
		 LINUX_FS_STRUCT_FOP_HAS_FLOCK
787
		 LINUX_FS_STRUCT_FOP_HAS_FLOCK
776
		 LINUX_FS_STRUCT_FOP_HAS_SENDFILE
788
		 LINUX_FS_STRUCT_FOP_HAS_SENDFILE
Lines 817-822 case $AFS_SYSNAME in *_linux* | *_umlinux*) Link Here
817
		 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
829
		 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
818
		 LINUX_HAVE_IGET
830
		 LINUX_HAVE_IGET
819
		 LINUX_HAVE_I_SIZE_READ
831
		 LINUX_HAVE_I_SIZE_READ
832
		 LINUX_HAVE_INODE_SETATTR
820
		 LINUX_FS_STRUCT_NAMEIDATA_HAS_PATH
833
		 LINUX_FS_STRUCT_NAMEIDATA_HAS_PATH
821
	         LINUX_EXPORTS_INIT_MM
834
	         LINUX_EXPORTS_INIT_MM
822
                 LINUX_EXPORTS_SYS_CHDIR
835
                 LINUX_EXPORTS_SYS_CHDIR
Lines 910-915 case $AFS_SYSNAME in *_linux* | *_umlinux*) Link Here
910
		 if test "x$ac_cv_linux_fs_struct_super_has_alloc_inode" = "xyes" ; then
923
		 if test "x$ac_cv_linux_fs_struct_super_has_alloc_inode" = "xyes" ; then
911
		  AC_DEFINE(STRUCT_SUPER_HAS_ALLOC_INODE, 1, [define if your struct super_operations has alloc_inode])
924
		  AC_DEFINE(STRUCT_SUPER_HAS_ALLOC_INODE, 1, [define if your struct super_operations has alloc_inode])
912
		 fi
925
		 fi
926
		 if test "x$ac_cv_linux_fs_struct_super_has_evict_inode" = "xyes" ; then
927
		  AC_DEFINE(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE, 1, [define if your struct super_operations has evict_inode])
928
		 fi
913
		 if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
929
		 if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
914
		  AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, 1, [define if your struct address_space has page_lock])
930
		  AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, 1, [define if your struct address_space has page_lock])
915
		 fi
931
		 fi
(-)a/configure-libafs.in (-3 / +3 lines)
Lines 1-8 Link Here
1
AC_INIT(src/libafs/Makefile.common.in)
1
AC_INIT(src/libafs/Makefile.common.in)
2
AM_INIT_AUTOMAKE(openafs-libafs,1.4.12.1)
2
AM_INIT_AUTOMAKE(openafs-libafs,1.4.12)
3
AC_CONFIG_HEADER(src/config/afsconfig.h)
3
AC_CONFIG_HEADER(src/config/afsconfig.h)
4
MACOS_VERSION=1.4.12f1
4
MACOS_VERSION=1.4.12
5
LINUX_PKGVER=1.4.12.1
5
LINUX_PKGVER=1.4.12
6
LINUX_PKGREL=1.1
6
LINUX_PKGREL=1.1
7
#LINUX_PKGREL=0.pre4
7
#LINUX_PKGREL=0.pre4
8
8
(-)a/configure.in (-3 / +3 lines)
Lines 1-8 Link Here
1
AC_INIT(src/config/stds.h)
1
AC_INIT(src/config/stds.h)
2
AM_INIT_AUTOMAKE(openafs,1.4.12.1)
2
AM_INIT_AUTOMAKE(openafs,1.4.12)
3
AC_CONFIG_HEADER(src/config/afsconfig.h)
3
AC_CONFIG_HEADER(src/config/afsconfig.h)
4
MACOS_VERSION=1.4.12f1
4
MACOS_VERSION=1.4.12
5
LINUX_PKGVER=1.4.12.1
5
LINUX_PKGVER=1.4.12
6
LINUX_PKGREL=1.1
6
LINUX_PKGREL=1.1
7
#LINUX_PKGREL=0.pre3
7
#LINUX_PKGREL=0.pre3
8
8
(-)a/doc/man-pages/pod1/fs_listquota.pod (-8 / +1 lines)
Lines 30-43 To set volume quota, use the B<fs setquota> or B<fs setvol> command. Link Here
30
30
31
=head1 CAUTIONS
31
=head1 CAUTIONS
32
32
33
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
33
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
34
and the maximum size of a /vicepX partition on a fileserver is also 2
35
terabytes. The fileserver will not report an error when it has access
36
to a partition larger than 2 terabytes, but it will probably fail if
37
the administrator attempts to use more than 2 terabytes of space. In
38
addition, there are reports of erroneous disk usage numbers when
39
B<vos partinfo> or other OpenAFS disk reporting tools are used with
40
partitions larger than 2 terabytes.
41
34
42
=head1 OPTIONS
35
=head1 OPTIONS
43
36
(-)a/doc/man-pages/pod1/fs_quota.pod (-8 / +1 lines)
Lines 26-39 To set volume quota, use the B<fs setquota> or B<fs setvol> command. Link Here
26
26
27
=head1 CAUTIONS
27
=head1 CAUTIONS
28
28
29
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
29
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
30
and the maximum size of a /vicepX partition on a fileserver is also 2
31
terabytes. The fileserver will not report an error when it has access
32
to a partition larger than 2 terabytes, but it will probably fail if
33
the administrator attempts to use more than 2 terabytes of space. In
34
addition, there are reports of erroneous disk usage numbers when
35
B<vos partinfo> or other OpenAFS disk reporting tools are used with
36
partitions larger than 2 terabytes.
37
30
38
=head1 OPTIONS
31
=head1 OPTIONS
39
32
(-)a/doc/man-pages/pod1/fs_setquota.pod (-8 / +1 lines)
Lines 31-44 B<fs quota> command. Link Here
31
31
32
=head1 CAUTIONS
32
=head1 CAUTIONS
33
33
34
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
34
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
35
and the maximum size of a /vicepX partition on a fileserver is also 2
36
terabytes. The fileserver will not report an error when it has access
37
to a partition larger than 2 terabytes, but it will probably fail if
38
the administrator attempts to use more than 2 terabytes of space. In
39
addition, there are reports of erroneous disk usage numbers when
40
B<vos partinfo> or other OpenAFS disk reporting tools are used with
41
partitions larger than 2 terabytes.
42
35
43
=head1 OPTIONS
36
=head1 OPTIONS
44
37
(-)a/doc/man-pages/pod1/fs_setvol.pod (-8 / +1 lines)
Lines 38-51 To set quota on one volume at a time, use the B<fs setquota> command. Link Here
38
38
39
=head1 CAUTIONS
39
=head1 CAUTIONS
40
40
41
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
41
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
42
and the maximum size of a /vicepX partition on a fileserver is also 2
43
terabytes. The fileserver will not report an error when it has access
44
to a partition larger than 2 terabytes, but it will probably fail if
45
the administrator attempts to use more than 2 terabytes of space. In
46
addition, there are reports of erroneous disk usage numbers when
47
B<vos partinfo> or other OpenAFS disk reporting tools are used with
48
partitions larger than 2 terabytes.
49
42
50
=head1 OPTIONS
43
=head1 OPTIONS
51
44
(-)a/doc/man-pages/pod1/vos.pod (-8 / +1 lines)
Lines 100-113 Commands to obtain help: B<vos apropos> and B<vos help>. Link Here
100
100
101
=head1 CAUTIONS
101
=head1 CAUTIONS
102
102
103
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
103
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
104
and the maximum size of a /vicepX partition on a fileserver is also 2
105
terabytes. The fileserver will not report an error when it has access
106
to a partition larger than 2 terabytes, but it will probably fail if
107
the administrator attempts to use more than 2 terabytes of space. In
108
addition, there are reports of erroneous disk usage numbers when
109
B<vos partinfo> or other OpenAFS disk reporting tools are used with
110
partitions larger than 2 terabytes.
111
104
112
=head1 OPTIONS
105
=head1 OPTIONS
113
106
(-)a/doc/man-pages/pod1/vos_copy.pod (-8 / +1 lines)
Lines 27-40 the volume be stored locally by the client. Link Here
27
27
28
=head1 CAUTIONS
28
=head1 CAUTIONS
29
29
30
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
30
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
31
and the maximum size of a /vicepX partition on a fileserver is also 2
32
terabytes. The fileserver will not report an error when it has access
33
to a partition larger than 2 terabytes, but it will probably fail if
34
the administrator attempts to use more than 2 terabytes of space. In
35
addition, there are reports of erroneous disk usage numbers when
36
B<vos partinfo> or other OpenAFS disk reporting tools are used with
37
partitions larger than 2 terabytes.
38
31
39
=head1 OPTIONS
32
=head1 OPTIONS
40
33
(-)a/doc/man-pages/pod1/vos_create.pod (-8 / +1 lines)
Lines 64-77 mount it in the file space by using the B<fs mkmount> command. Link Here
64
64
65
=head1 CAUTIONS
65
=head1 CAUTIONS
66
66
67
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
67
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
68
and the maximum size of a /vicepX partition on a fileserver is also 2
69
terabytes. The fileserver will not report an error when it has access
70
to a partition larger than 2 terabytes, but it will probably fail if
71
the administrator attempts to use more than 2 terabytes of space. In
72
addition, there are reports of erroneous disk usage numbers when
73
B<vos partinfo> or other OpenAFS disk reporting tools are used with
74
partitions larger than 2 terabytes.
75
68
76
=head1 OPTIONS
69
=head1 OPTIONS
77
70
(-)a/doc/man-pages/pod1/vos_examine.pod (-8 / +1 lines)
Lines 34-47 display information from the VLDB only, use the B<vos listvldb> command. Link Here
34
34
35
=head1 CAUTIONS
35
=head1 CAUTIONS
36
36
37
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
37
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
38
and the maximum size of a /vicepX partition on a fileserver is also 2
39
terabytes. The fileserver will not report an error when it has access
40
to a partition larger than 2 terabytes, but it will probably fail if
41
the administrator attempts to use more than 2 terabytes of space. In
42
addition, there are reports of erroneous disk usage numbers when
43
B<vos partinfo> or other OpenAFS disk reporting tools are used with
44
partitions larger than 2 terabytes.
45
38
46
=head1 OPTIONS
39
=head1 OPTIONS
47
40
(-)a/doc/man-pages/pod1/vos_move.pod (-8 / +1 lines)
Lines 86-99 confirmation of the kill signal: Link Here
86
To confirm termination of the operation, press Ctrl-C a second time; press
86
To confirm termination of the operation, press Ctrl-C a second time; press
87
any other key to continue the operation.
87
any other key to continue the operation.
88
88
89
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
89
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
90
and the maximum size of a /vicepX partition on a fileserver is also 2
91
terabytes. The fileserver will not report an error when it has access
92
to a partition larger than 2 terabytes, but it will probably fail if
93
the administrator attempts to use more than 2 terabytes of space. In
94
addition, there are reports of erroneous disk usage numbers when
95
B<vos partinfo> or other OpenAFS disk reporting tools are used with
96
partitions larger than 2 terabytes.
97
90
98
=head1 OPTIONS
91
=head1 OPTIONS
99
92
(-)a/doc/man-pages/pod1/vos_partinfo.pod (-8 / +1 lines)
Lines 27-40 consulted. Link Here
27
27
28
=head1 CAUTIONS
28
=head1 CAUTIONS
29
29
30
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes)
30
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
31
and the maximum size of a /vicepX partition on a fileserver is also 2
32
terabytes. The fileserver will not report an error when it has access
33
to a partition larger than 2 terabytes, but it will probably fail if
34
the administrator attempts to use more than 2 terabytes of space. In
35
addition, there are reports of erroneous disk usage numbers when
36
B<vos partinfo> or other OpenAFS disk reporting tools are used with
37
partitions larger than 2 terabytes.
38
31
39
=head1 OPTIONS
32
=head1 OPTIONS
40
33
(-)a/src/afs/LINUX/osi_compat.h (-26 / +28 lines)
Lines 51-82 afs_posix_test_lock(struct file *fp, struct file_lock *flp) { Link Here
51
#endif
51
#endif
52
}
52
}
53
53
54
#ifdef DCACHE_NFSFS_RENAMED
55
static inline void
56
afs_linux_clear_nfsfs_renamed(struct dentry *dp) {
57
    spin_lock(&dp->d_lock);
58
    dp->d_flags &= ~DCACHE_NFSFS_RENAMED;
59
    spin_unlock(&dp->d_lock);
60
}
61
62
static inline void
63
afs_linux_set_nfsfs_renamed(struct dentry *dp) {
64
    spin_lock(&dp->d_lock);
65
    dp->d_flags |= DCACHE_NFSFS_RENAMED;
66
    spin_unlock(&dp->d_lock);
67
}
68
#else
69
static inline void afs_linux_clear_nfsfs_renamed(void) { return; }
70
static inline void afs_linux_set_nfsfs_renamed(void) { return; }
71
#endif
72
73
#ifndef HAVE_KERNEL_HLIST_UNHASHED
74
static void
75
hlist_unhashed(const struct hlist_node *h) {
76
    return (!h->pprev == NULL);
77
}
78
#endif
79
80
#if defined(WRITEPAGE_ACTIVATE)
54
#if defined(WRITEPAGE_ACTIVATE)
81
#define AOP_WRITEPAGE_ACTIVATE WRITEPAGE_ACTIVATE
55
#define AOP_WRITEPAGE_ACTIVATE WRITEPAGE_ACTIVATE
82
#endif
56
#endif
Lines 136-139 init_once_func(void * foo) { Link Here
136
#define KALLOC_TYPE GFP_KERNEL
110
#define KALLOC_TYPE GFP_KERNEL
137
#endif
111
#endif
138
112
113
#ifdef LINUX_KEYRING_SUPPORT
114
# ifndef KEY_ALLOC_NOT_IN_QUOTA
115
#  define KEY_ALLOC_NOT_IN_QUOTA 1
116
# endif
117
# ifndef KEY_ALLOC_IN_QUOTA
118
#  define KEY_ALLOC_IN_QUOTA 0
119
# endif
120
#endif
139
#endif
121
#endif
122
123
static inline int
124
afs_inode_setattr(struct osi_file *afile, struct iattr *newattrs) {
125
126
    int code = 0;
127
    struct inode *inode = OSIFILE_INODE(afile);
128
#if !defined(HAVE_LINUX_INODE_SETATTR)
129
    code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
130
#elif defined(INODE_SETATTR_NOT_VOID)
131
#if defined(AFS_LINUX26_ENV)
132
    if (inode->i_op && inode->i_op->setattr)
133
	code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
134
    else
135
#endif
136
	code = inode_setattr(inode, newattrs);
137
#else
138
    inode_setattr(inode, newattrs);
139
#endif
140
    return code;
141
}
(-)a/src/afs/LINUX/osi_file.c (-11 / +2 lines)
Lines 21-26 Link Here
21
#if !defined(HAVE_IGET)
21
#if !defined(HAVE_IGET)
22
#include "h/exportfs.h"
22
#include "h/exportfs.h"
23
#endif
23
#endif
24
#include "osi_compat.h"
24
25
25
int afs_osicred_initialized = 0;
26
int afs_osicred_initialized = 0;
26
struct AFS_UCRED afs_osi_cred;
27
struct AFS_UCRED afs_osi_cred;
Lines 237-253 osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize) Link Here
237
    lock_kernel();
238
    lock_kernel();
238
    code = inode_change_ok(inode, &newattrs);
239
    code = inode_change_ok(inode, &newattrs);
239
    if (!code)
240
    if (!code)
240
#ifdef INODE_SETATTR_NOT_VOID
241
	code = afs_inode_setattr(afile, &newattrs);
241
#if defined(AFS_LINUX26_ENV)
242
	if (inode->i_op && inode->i_op->setattr)
243
	    code = inode->i_op->setattr(afile->filp->f_dentry, &newattrs);
244
	else
245
#endif
246
	    code = inode_setattr(inode, &newattrs);
247
#else
248
        inode_setattr(inode, &newattrs);
249
#endif
250
    unlock_kernel();
251
    if (!code)
242
    if (!code)
252
	truncate_inode_pages(&inode->i_data, asize);
243
	truncate_inode_pages(&inode->i_data, asize);
253
#else
244
#else
(-)a/src/afs/LINUX/osi_groups.c (-5 / +10 lines)
Lines 338-346 setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, Link Here
338
#ifdef LINUX_KEYRING_SUPPORT
338
#ifdef LINUX_KEYRING_SUPPORT
339
    if (code == 0) {
339
    if (code == 0) {
340
340
341
	(void) install_session_keyring(NULL);
341
	code = install_session_keyring(NULL);
342
342
343
	if (current_session_keyring()) {
343
	if (code == 0 && current_session_keyring()) {
344
	    struct key *key;
344
	    struct key *key;
345
	    key_perm_t perm;
345
	    key_perm_t perm;
346
346
Lines 348-364 setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, Link Here
348
	    perm |= KEY_USR_VIEW | KEY_USR_SEARCH;
348
	    perm |= KEY_USR_VIEW | KEY_USR_SEARCH;
349
349
350
#if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
350
#if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
351
	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current, perm, 1);
351
	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current,
352
			    perm, KEY_ALLOC_NOT_IN_QUOTA);
352
#elif defined(KEY_ALLOC_NEEDS_CRED)
353
#elif defined(KEY_ALLOC_NEEDS_CRED)
353
	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current_cred(), perm, 1);
354
	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current_cred(),
355
			    perm, KEY_ALLOC_NOT_IN_QUOTA);
354
#else
356
#else
355
	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, perm, 1);
357
	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, perm,
358
			    KEY_ALLOC_NOT_IN_QUOTA);
356
#endif
359
#endif
357
360
358
	    if (!IS_ERR(key)) {
361
	    if (!IS_ERR(key)) {
359
		key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
362
		key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
360
					 current_session_keyring(), NULL);
363
					 current_session_keyring(), NULL);
361
		key_put(key);
364
		key_put(key);
365
	    } else {
366
		code = PTR_ERR(key);
362
	    }
367
	    }
363
	}
368
	}
364
    }
369
    }
(-)a/src/afs/LINUX/osi_module.c (+4 lines)
Lines 134-141 static int c_show(struct seq_file *m, void *p) Link Here
134
		if (!tc->cellHosts[j]) break;
134
		if (!tc->cellHosts[j]) break;
135
135
136
		addr = tc->cellHosts[j]->addr->sa_ip;
136
		addr = tc->cellHosts[j]->addr->sa_ip;
137
#if defined(NIPQUAD)
137
		seq_printf(m, "%u.%u.%u.%u #%u.%u.%u.%u\n",
138
		seq_printf(m, "%u.%u.%u.%u #%u.%u.%u.%u\n",
138
			   NIPQUAD(addr), NIPQUAD(addr));
139
			   NIPQUAD(addr), NIPQUAD(addr));
140
#else
141
		seq_printf(m, "%pI4 #%pI4\n", &addr, &addr);
142
#endif
139
	}
143
	}
140
144
141
	return 0;
145
	return 0;
(-)a/src/afs/LINUX/osi_vfsops.c (-8 / +36 lines)
Lines 140-159 afs_read_super(struct super_block *sb, void *data, int silent) Link Here
140
    sb->s_blocksize_bits = 10;
140
    sb->s_blocksize_bits = 10;
141
    sb->s_magic = AFS_VFSMAGIC;
141
    sb->s_magic = AFS_VFSMAGIC;
142
    sb->s_op = &afs_sops;	/* Super block (vfs) ops */
142
    sb->s_op = &afs_sops;	/* Super block (vfs) ops */
143
#if defined(AFS_LINUX26_ENV)
143
    /* used for inodes backing_dev_info field, also */
144
    /* used for inodes backing_dev_info field, also */
144
    afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info));
145
    afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info));
145
#if defined(HAVE_BDI_INIT)
146
# if defined(HAVE_BDI_INIT)
146
    bdi_init(afs_backing_dev_info);
147
    bdi_init(afs_backing_dev_info);
147
#endif
148
# endif
148
#if defined(STRUCT_BDI_HAS_NAME)
149
# if defined(STRUCT_BDI_HAS_NAME)
149
    afs_backing_dev_info->name = "openafs";
150
    afs_backing_dev_info->name = "openafs";
150
#endif
151
# endif
151
    afs_backing_dev_info->ra_pages = 0;
152
    afs_backing_dev_info->ra_pages = 0;
152
#if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI)
153
# if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI)
153
    sb->s_bdi = afs_backing_dev_info;
154
    sb->s_bdi = afs_backing_dev_info;
154
    /* The name specified here will appear in the flushing thread name - flush-afs */
155
    /* The name specified here will appear in the flushing thread name - flush-afs */
155
    bdi_register(afs_backing_dev_info, NULL, "afs");
156
    bdi_register(afs_backing_dev_info, NULL, "afs");
156
#endif
157
# endif
158
#endif /* AFS_LINUX26_ENV */
157
#if defined(MAX_NON_LFS)
159
#if defined(MAX_NON_LFS)
158
#ifdef AFS_64BIT_CLIENT
160
#ifdef AFS_64BIT_CLIENT
159
#if !defined(MAX_LFS_FILESIZE)
161
#if !defined(MAX_LFS_FILESIZE)
Lines 340-345 afs_destroy_inodecache(void) Link Here
340
}
342
}
341
#endif
343
#endif
342
344
345
#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
346
static void
347
afs_evict_inode(struct inode *ip)
348
{
349
    struct vcache *vcp = VTOAFS(ip);
350
351
    if (vcp->vlruq.prev || vcp->vlruq.next)
352
	osi_Panic("inode freed while on LRU");
353
    if (vcp->hnext)
354
	osi_Panic("inode freed while still hashed");
355
356
    truncate_inode_pages(&ip->i_data, 0);
357
    end_writeback(ip);
358
359
#if !defined(STRUCT_SUPER_HAS_ALLOC_INODE)
360
    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
361
#endif
362
}
363
#else
343
static void
364
static void
344
afs_clear_inode(struct inode *ip)
365
afs_clear_inode(struct inode *ip)
345
{
366
{
Lines 354-359 afs_clear_inode(struct inode *ip) Link Here
354
    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
375
    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
355
#endif
376
#endif
356
}
377
}
378
#endif
357
379
358
/* afs_put_super
380
/* afs_put_super
359
 * Called from unmount to release super_block. */
381
 * Called from unmount to release super_block. */
Lines 380-389 afs_put_super(struct super_block *sbp) Link Here
380
#endif
402
#endif
381
403
382
    osi_linux_verify_alloced_memory();
404
    osi_linux_verify_alloced_memory();
383
#if defined(HAVE_BDI_INIT)
405
#if defined(AFS_LINUX26_ENV)
406
# if defined(HAVE_BDI_INIT)
384
    bdi_destroy(afs_backing_dev_info);
407
    bdi_destroy(afs_backing_dev_info);
385
#endif
408
# endif
386
    osi_Free(afs_backing_dev_info, sizeof(struct backing_dev_info));
409
    osi_Free(afs_backing_dev_info, sizeof(struct backing_dev_info));
410
#endif /* AFS_LINUX26_ENV */
387
    AFS_GUNLOCK();
411
    AFS_GUNLOCK();
388
412
389
    sbp->s_dev = 0;
413
    sbp->s_dev = 0;
Lines 452-458 struct super_operations afs_sops = { Link Here
452
  .alloc_inode =	afs_alloc_inode,
476
  .alloc_inode =	afs_alloc_inode,
453
  .destroy_inode =	afs_destroy_inode,
477
  .destroy_inode =	afs_destroy_inode,
454
#endif
478
#endif
479
#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
480
  .evict_inode =	afs_evict_inode,
481
#else
455
  .clear_inode =	afs_clear_inode,
482
  .clear_inode =	afs_clear_inode,
483
#endif
456
  .put_super =		afs_put_super,
484
  .put_super =		afs_put_super,
457
  .statfs =		afs_statfs,
485
  .statfs =		afs_statfs,
458
#if !defined(AFS_LINUX24_ENV)
486
#if !defined(AFS_LINUX24_ENV)
(-)a/src/afs/LINUX/osi_vnodeops.c (-4 / +7 lines)
Lines 447-454 afs_linux_release(struct inode *ip, struct file *fp) Link Here
447
}
447
}
448
448
449
static int
449
static int
450
#if defined(AFS_LINUX24_ENV)
450
#if defined(AFS_LINUX24_ENV) && defined(FOP_FSYNC_TAKES_DENTRY)
451
afs_linux_fsync(struct file *fp, struct dentry *dp, int datasync)
451
afs_linux_fsync(struct file *fp, struct dentry *dp, int datasync)
452
#elif defined(AFS_LINUX24_ENV)
453
afs_linux_fsync(struct file *fp, int datasync)
452
#else
454
#else
453
afs_linux_fsync(struct file *fp, struct dentry *dp)
455
afs_linux_fsync(struct file *fp, struct dentry *dp)
454
#endif
456
#endif
Lines 1815-1825 afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, Link Here
1815
1817
1816
    code = afs_linux_writepage_sync(file->f_dentry->d_inode, page,
1818
    code = afs_linux_writepage_sync(file->f_dentry->d_inode, page,
1817
                                    offset, to - offset);
1819
                                    offset, to - offset);
1818
#if !defined(AFS_LINUX26_ENV)
1820
#if defined(AFS_LINUX26_ENV)
1819
    kunmap(page);
1820
#endif
1821
    if (code == WRITEPAGE_ACTIVATE)
1821
    if (code == WRITEPAGE_ACTIVATE)
1822
	code = -EIO;
1822
	code = -EIO;
1823
#else
1824
    kunmap(page);
1825
#endif
1823
1826
1824
    return code;
1827
    return code;
1825
}
1828
}
(-)a/src/afs/OBSD/osi_groups.c (+10 lines)
Lines 81-86 setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue, Link Here
81
81
82
    AFS_STATCNT(setpag);
82
    AFS_STATCNT(setpag);
83
    ngroups = afs_getgroups(*cred, NGROUPS, gidset);
83
    ngroups = afs_getgroups(*cred, NGROUPS, gidset);
84
    /*
85
     * If the group list is empty, use the task's primary group as the group
86
     * list. Otherwise, when setting the PAG, group 0 will be set to arbitrary
87
     * gibberish and the PAG, which starts at group offset 1, will not be
88
     * properly set because the group count will be wrong (2 instead of 3).
89
     */
90
    if (ngroups == 0) {
91
	gidset[0] = (*cred)->cr_gid;
92
	ngroups = 1;
93
    }
84
    if (afs_get_pag_from_groups(gidset[1], gidset[2]) == NOPAG) {
94
    if (afs_get_pag_from_groups(gidset[1], gidset[2]) == NOPAG) {
85
	/* We will have to shift grouplist to make room for pag */
95
	/* We will have to shift grouplist to make room for pag */
86
	if (ngroups + 2 > NGROUPS) {
96
	if (ngroups + 2 > NGROUPS) {
(-)a/src/afs/OBSD/osi_machdep.h (-1 / +1 lines)
Lines 86-92 extern void osi_obsd_Free(void *p, size_t asize); Link Here
86
  free((p), (mflags))
86
  free((p), (mflags))
87
#else
87
#else
88
#define BSD_KMALLOC MALLOC
88
#define BSD_KMALLOC MALLOC
89
#define BSD_KFREE KFREE
89
#define BSD_KFREE FREE
90
#endif /* AFS_OBSD42_ENV */
90
#endif /* AFS_OBSD42_ENV */
91
91
92
/* proc, cred */
92
/* proc, cred */
(-)a/src/afs/SOLARIS/osi_machdep.h (-1 / +17 lines)
Lines 56-62 local_osi_Time() Link Here
56
#undef afs_osi_Alloc_NoSleep
56
#undef afs_osi_Alloc_NoSleep
57
extern void *afs_osi_Alloc_NoSleep(size_t size);
57
extern void *afs_osi_Alloc_NoSleep(size_t size);
58
58
59
#define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
59
#ifdef AFS_SUN58_ENV
60
# define osi_vnhold(avc, r)  do {    \
61
    struct vnode *vp = AFSTOV(avc); \
62
    uint_t prevcount;               \
63
                                    \
64
    mutex_enter(&vp->v_lock);       \
65
    prevcount = vp->v_count++;      \
66
    mutex_exit(&vp->v_lock);        \
67
                                    \
68
    if (prevcount == 0) {           \
69
	VFS_HOLD(afs_globalVFS);    \
70
    }                               \
71
} while(0)
72
#else /* !AFS_SUN58_ENV */
73
# define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
74
#endif /* !AFS_SUN58_ENV */
75
60
#define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
76
#define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
61
  vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
77
  vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
62
#define gop_lookupname(fnamep,segflg,followlink,compvpp) \
78
#define gop_lookupname(fnamep,segflg,followlink,compvpp) \
(-)a/src/afs/SOLARIS/osi_vfsops.c (-4 / +54 lines)
Lines 24-30 Link Here
24
#endif
24
#endif
25
#include <sys/kobj.h>
25
#include <sys/kobj.h>
26
26
27
27
#ifdef AFS_SUN58_ENV
28
# include <sys/mount.h>
29
#endif
28
30
29
struct vfs *afs_globalVFS = 0;
31
struct vfs *afs_globalVFS = 0;
30
struct vcache *afs_globalVp = 0;
32
struct vcache *afs_globalVp = 0;
Lines 77-82 int Link Here
77
afs_unmount(struct vfs *afsp, struct AFS_UCRED *credp)
79
afs_unmount(struct vfs *afsp, struct AFS_UCRED *credp)
78
#endif
80
#endif
79
{
81
{
82
    struct vcache *rootvp = NULL;
83
80
    AFS_GLOCK();
84
    AFS_GLOCK();
81
    AFS_STATCNT(afs_unmount);
85
    AFS_STATCNT(afs_unmount);
82
86
Lines 88-100 afs_unmount(struct vfs *afsp, struct AFS_UCRED *credp) Link Here
88
        AFS_GUNLOCK();
92
        AFS_GUNLOCK();
89
        return (EPERM);
93
        return (EPERM);
90
    }
94
    }
95
96
#ifdef AFS_SUN58_ENV
97
    if (flag & MS_FORCE) {
98
	AFS_GUNLOCK();
99
	return ENOTSUP;
100
    }
101
102
    /* We should have one reference from the caller, and one reference for the
103
     * root vnode; any more and someone is still referencing something */
104
    if (afsp->vfs_count > 2) {
105
	AFS_GUNLOCK();
106
	return EBUSY;
107
    }
108
109
    /* The root vnode should have one ref for the mount; any more, and someone
110
     * else is using the root vnode */
111
    if (afs_globalVp && VREFCOUNT_GT(afs_globalVp, 1)) {
112
	AFS_GUNLOCK();
113
	return EBUSY;
114
    }
115
116
    afsp->vfs_flag |= VFS_UNMOUNTED;
117
#endif /* AFS_SUN58_ENV */
118
119
    /* release the root vnode, which should be the last reference to us
120
     * besides the caller of afs_unmount */
121
    rootvp = afs_globalVp;
122
    afs_globalVp = NULL;
123
    AFS_RELE(rootvp);
124
125
#ifndef AFS_SUN58_ENV
126
    /* shutdown now, since afs_freevfs() will not be called */
91
    afs_globalVFS = 0;
127
    afs_globalVFS = 0;
92
    afs_shutdown();
128
    afs_shutdown();
129
#endif /* !AFS_SUN58_ENV */
93
130
94
    AFS_GUNLOCK();
131
    AFS_GUNLOCK();
95
    return 0;
132
    return 0;
96
}
133
}
97
134
135
#ifdef AFS_SUN58_ENV
136
void
137
afs_freevfs(struct vfs *afsp)
138
{
139
    AFS_GLOCK();
140
141
    afs_globalVFS = 0;
142
    afs_shutdown();
143
144
    AFS_GUNLOCK();
145
}
146
#endif /* AFS_SUN58_ENV */
147
98
int
148
int
99
afs_root(struct vfs *afsp, struct vnode **avpp)
149
afs_root(struct vfs *afsp, struct vnode **avpp)
100
{
150
{
Lines 265-271 static const fs_operation_def_t afs_vfsops_template[] = { Link Here
265
    VFSNAME_SYNC,		{ .vfs_sync = afs_sync },
315
    VFSNAME_SYNC,		{ .vfs_sync = afs_sync },
266
    VFSNAME_VGET,		{ .vfs_vget = afs_vget },
316
    VFSNAME_VGET,		{ .vfs_vget = afs_vget },
267
    VFSNAME_MOUNTROOT,  	{ .vfs_mountroot = afs_mountroot },
317
    VFSNAME_MOUNTROOT,  	{ .vfs_mountroot = afs_mountroot },
268
    VFSNAME_FREEVFS,		{ .vfs_freevfs = fs_freevfs },
318
    VFSNAME_FREEVFS,		{ .vfs_freevfs = afs_freevfs },
269
    NULL,			NULL
319
    NULL,			NULL
270
};
320
};
271
struct vfsops *afs_vfsopsp;
321
struct vfsops *afs_vfsopsp;
Lines 279-285 const fs_operation_def_t afs_vfsops_template[] = { Link Here
279
    VFSNAME_SYNC,		afs_sync,
329
    VFSNAME_SYNC,		afs_sync,
280
    VFSNAME_VGET,		afs_vget,
330
    VFSNAME_VGET,		afs_vget,
281
    VFSNAME_MOUNTROOT,  	afs_mountroot,
331
    VFSNAME_MOUNTROOT,  	afs_mountroot,
282
    VFSNAME_FREEVFS,		fs_freevfs,
332
    VFSNAME_FREEVFS,		afs_freevfs,
283
    NULL,			NULL
333
    NULL,			NULL
284
};
334
};
285
struct vfsops *afs_vfsopsp;
335
struct vfsops *afs_vfsopsp;
Lines 294-300 struct vfsops Afs_vfsops = { Link Here
294
    afs_mountroot,
344
    afs_mountroot,
295
    afs_swapvp,
345
    afs_swapvp,
296
#if defined(AFS_SUN58_ENV)
346
#if defined(AFS_SUN58_ENV)
297
    fs_freevfs,
347
    afs_freevfs,
298
#endif
348
#endif
299
};
349
};
300
#endif
350
#endif
(-)a/src/afs/SOLARIS/osi_vnodeops.c (+4 lines)
Lines 1923-1928 afs_inactive(struct vcache *avc, struct AFS_UCRED *acred) Link Here
1923
	avc->opens = avc->execsOrWriters = 0;
1923
	avc->opens = avc->execsOrWriters = 0;
1924
1924
1925
    afs_InactiveVCache(avc, acred);
1925
    afs_InactiveVCache(avc, acred);
1926
1927
#ifdef AFS_SUN58_ENV
1928
    VFS_RELE(afs_globalVFS);
1929
#endif
1926
}
1930
}
1927
1931
1928
void
1932
void
(-)a/src/afs/VNOPS/afs_vnop_flock.c (-18 / +2 lines)
Lines 539-562 int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd, Link Here
539
#else
539
#else
540
	) {
540
	) {
541
#endif
541
#endif
542
    /* this next check is safer when left out, but more applications work
542
    /* Java VMs ask for l_len=(long)-1 regardless of OS/CPU */
543
     * with it in.  However, they fail in race conditions.  The question is
543
    if ((sizeof(af->l_len) == 8) && (af->l_len == 0x7fffffffffffffffLL))
544
     * what to do for people who don't have source to their application;
545
     * this way at least, they can get work done */
546
#ifdef AFS_LINUX24_ENV
547
    if (af->l_len == OFFSET_MAX)
548
	af->l_len = 0;		/* since some systems indicate it as EOF */
549
#else
550
    if (af->l_len == 0x7fffffff)
551
	af->l_len = 0;		/* since some systems indicate it as EOF */
552
#ifdef AFS_LINUX_64BIT_KERNEL
553
    if (af->l_len == LONG_MAX)
554
	af->l_len = 0;		/* since some systems indicate it as EOF */
555
#endif
556
#endif
557
    /* Java VMs ask for l_len=(long)-1 regardless of OS/CPU; bottom 32 bits
558
     * sometimes get masked off by OS */
559
    if ((sizeof(af->l_len) == 8) && (af->l_len == 0x7ffffffffffffffe))
560
	af->l_len = 0;
544
	af->l_len = 0;
561
    /* next line makes byte range locks always succeed,
545
    /* next line makes byte range locks always succeed,
562
     * even when they should block */
546
     * even when they should block */
(-)a/src/afs/afs.h (-1 / +1 lines)
Lines 75-81 extern int afs_shuttingdown; Link Here
75
#define	PIGGYSIZE	1350	/* max piggyback size */
75
#define	PIGGYSIZE	1350	/* max piggyback size */
76
#define	MAXVOLS		128	/* max vols we can store */
76
#define	MAXVOLS		128	/* max vols we can store */
77
#define	MAXSYSNAME	128	/* max sysname (i.e. @sys) size */
77
#define	MAXSYSNAME	128	/* max sysname (i.e. @sys) size */
78
#define MAXNUMSYSNAMES	16	/* max that current constants allow */
78
#define MAXNUMSYSNAMES	32	/* max that current constants allow */
79
#define	NOTOKTIMEOUT	(2*3600)	/* time after which to timeout conns sans tokens */
79
#define	NOTOKTIMEOUT	(2*3600)	/* time after which to timeout conns sans tokens */
80
#define	NOPAG		0xffffffff
80
#define	NOPAG		0xffffffff
81
#define AFS_NCBRS	300	/* max # of call back return entries */
81
#define AFS_NCBRS	300	/* max # of call back return entries */
(-)a/src/afs/afs_osi.c (-1 / +1 lines)
Lines 483-489 afs_osi_Free(void *x, size_t asize) Link Here
483
    osi_linux_free(x);
483
    osi_linux_free(x);
484
#elif defined(AFS_FBSD_ENV)
484
#elif defined(AFS_FBSD_ENV)
485
    osi_fbsd_free(x);
485
    osi_fbsd_free(x);
486
#elif defined(AFS_OBSD44_ENV)
486
#elif defined(AFS_OBSD_ENV)
487
    osi_obsd_Free(x, asize);
487
    osi_obsd_Free(x, asize);
488
#else
488
#else
489
    AFS_KFREE((struct osimem *)x, asize);
489
    AFS_KFREE((struct osimem *)x, asize);
(-)a/src/afs/afs_vcache.c (+8 lines)
Lines 1084-1089 afs_NewVCache(struct VenusFid *afid, struct server *serverp) Link Here
1084
    tvc->vmh = tvc->segid = NULL;
1084
    tvc->vmh = tvc->segid = NULL;
1085
    tvc->credp = NULL;
1085
    tvc->credp = NULL;
1086
#endif
1086
#endif
1087
1088
#ifdef AFS_SUN58_ENV
1089
    /* Normally we do this in osi_vnhold when we notice the ref count went from
1090
     * 0 -> 1. But here we just set the refcount to 1, so we need to explicitly
1091
     * VFS_HOLD here. */
1092
    VFS_HOLD(afs_globalVFS);
1093
#endif /* AFS_SUN58_ENV */
1094
1087
#ifdef AFS_BOZONLOCK_ENV
1095
#ifdef AFS_BOZONLOCK_ENV
1088
#if	defined(AFS_SUN5_ENV)
1096
#if	defined(AFS_SUN5_ENV)
1089
    rw_init(&tvc->rwlock, "vcache rwlock", RW_DEFAULT, NULL);
1097
    rw_init(&tvc->rwlock, "vcache rwlock", RW_DEFAULT, NULL);
(-)a/src/afsmonitor/afsmon-output.c (-7 / +15 lines)
Lines 380-386 Print_fs_FullPerfInfo(a_fs_Results) Link Here
380
    afs_int32 numLongs;		/*# longwords received */
380
    afs_int32 numLongs;		/*# longwords received */
381
    struct fs_stats_FullPerfStats *fullPerfP;	/*Ptr to full perf stats */
381
    struct fs_stats_FullPerfStats *fullPerfP;	/*Ptr to full perf stats */
382
    char *printableTime;	/*Ptr to printable time string */
382
    char *printableTime;	/*Ptr to printable time string */
383
383
    time_t probeTime;
384
384
385
    numLongs = a_fs_Results->data.AFS_CollData_len;
385
    numLongs = a_fs_Results->data.AFS_CollData_len;
386
    if (numLongs != fullPerfLongs) {
386
    if (numLongs != fullPerfLongs) {
Lines 391-397 Print_fs_FullPerfInfo(a_fs_Results) Link Here
391
	return;
391
	return;
392
    }
392
    }
393
393
394
    printableTime = ctime((time_t *) & (a_fs_Results->probeTime));
394
    probeTime = a_fs_Results->probeTime;
395
    printableTime = ctime(&probeTime);
395
    printableTime[strlen(printableTime) - 1] = '\0';
396
    printableTime[strlen(printableTime) - 1] = '\0';
396
    fullPerfP = (struct fs_stats_FullPerfStats *)
397
    fullPerfP = (struct fs_stats_FullPerfStats *)
397
	(a_fs_Results->data.AFS_CollData_val);
398
	(a_fs_Results->data.AFS_CollData_val);
Lines 440-445 afsmon_fsOutput(a_outfile, a_detOutput) Link Here
440
    afs_int32 numLongs;		/* longwords in result */
441
    afs_int32 numLongs;		/* longwords in result */
441
    afs_int32 *currLong;	/* ptr to longwords in result */
442
    afs_int32 *currLong;	/* ptr to longwords in result */
442
    int i;
443
    int i;
444
    time_t probeTime;
443
445
444
    if (afsmon_debug) {
446
    if (afsmon_debug) {
445
	fprintf(debugFD, "[ %s ] Called, a_outfile= %s, a_detOutput= %d\n",
447
	fprintf(debugFD, "[ %s ] Called, a_outfile= %s, a_detOutput= %d\n",
Lines 455-461 afsmon_fsOutput(a_outfile, a_detOutput) Link Here
455
    }
457
    }
456
458
457
    /* get the probe time and strip the \n at the end */
459
    /* get the probe time and strip the \n at the end */
458
    printTime = ctime((time_t *) & (xstat_fs_Results.probeTime));
460
    probeTime = xstat_fs_Results.probeTime;
461
    printTime = ctime(&probeTime);
459
    printTime[strlen(printTime) - 1] = '\0';
462
    printTime[strlen(printTime) - 1] = '\0';
460
    hostname = xstat_fs_Results.connP->hostName;
463
    hostname = xstat_fs_Results.connP->hostName;
461
464
Lines 700-705 Print_cm_PerfInfo() Link Here
700
    afs_int32 numLongs;		/*# longwords received */
703
    afs_int32 numLongs;		/*# longwords received */
701
    struct afs_stats_CMPerf *perfP;	/*Ptr to performance stats */
704
    struct afs_stats_CMPerf *perfP;	/*Ptr to performance stats */
702
    char *printableTime;	/*Ptr to printable time string */
705
    char *printableTime;	/*Ptr to printable time string */
706
    time_t probeTime;
703
707
704
    numLongs = xstat_cm_Results.data.AFSCB_CollData_len;
708
    numLongs = xstat_cm_Results.data.AFSCB_CollData_len;
705
    if (numLongs != perfLongs) {
709
    if (numLongs != perfLongs) {
Lines 709-715 Print_cm_PerfInfo() Link Here
709
	return;
713
	return;
710
    }
714
    }
711
715
712
    printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
716
    probeTime = xstat_cm_Results.probeTime;
717
    printableTime = ctime(&probeTime);
713
    printableTime[strlen(printableTime) - 1] = '\0';
718
    printableTime[strlen(printableTime) - 1] = '\0';
714
    perfP = (struct afs_stats_CMPerf *)
719
    perfP = (struct afs_stats_CMPerf *)
715
	(xstat_cm_Results.data.AFSCB_CollData_val);
720
	(xstat_cm_Results.data.AFSCB_CollData_val);
Lines 926-932 Print_cm_FullPerfInfo() Link Here
926
    static afs_int32 fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2);	/*Correct #longs */
931
    static afs_int32 fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2);	/*Correct #longs */
927
    afs_int32 numLongs;		/*# longs actually received */
932
    afs_int32 numLongs;		/*# longs actually received */
928
    struct afs_stats_CMFullPerf *fullP;	/*Ptr to full perf info */
933
    struct afs_stats_CMFullPerf *fullP;	/*Ptr to full perf info */
929
934
    time_t probeTime;
930
    char *printableTime;	/*Ptr to printable time string */
935
    char *printableTime;	/*Ptr to printable time string */
931
936
932
    numLongs = xstat_cm_Results.data.AFSCB_CollData_len;
937
    numLongs = xstat_cm_Results.data.AFSCB_CollData_len;
Lines 938-944 Print_cm_FullPerfInfo() Link Here
938
	return;
943
	return;
939
    }
944
    }
940
945
941
    printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
946
    probeTime = xstat_cm_Results.probeTime;
947
    printableTime = ctime(&probeTime);
942
    printableTime[strlen(printableTime) - 1] = '\0';
948
    printableTime[strlen(printableTime) - 1] = '\0';
943
    fullP = (struct afs_stats_CMFullPerf *)
949
    fullP = (struct afs_stats_CMFullPerf *)
944
	(xstat_cm_Results.data.AFSCB_CollData_val);
950
	(xstat_cm_Results.data.AFSCB_CollData_val);
Lines 1020-1025 afsmon_cmOutput(a_outfile, a_detOutput) Link Here
1020
    afs_int32 numLongs;		/* longwords in result */
1026
    afs_int32 numLongs;		/* longwords in result */
1021
    afs_int32 *currLong;	/* ptr to longwords in result */
1027
    afs_int32 *currLong;	/* ptr to longwords in result */
1022
    int i;
1028
    int i;
1029
    time_t probeTime;
1023
1030
1024
    if (afsmon_debug) {
1031
    if (afsmon_debug) {
1025
	fprintf(debugFD, "[ %s ] Called, a_outfile= %s, a_detOutput= %d\n",
1032
	fprintf(debugFD, "[ %s ] Called, a_outfile= %s, a_detOutput= %d\n",
Lines 1036-1042 afsmon_cmOutput(a_outfile, a_detOutput) Link Here
1036
    }
1043
    }
1037
1044
1038
    /* get the probe time and strip the \n at the end */
1045
    /* get the probe time and strip the \n at the end */
1039
    printTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
1046
    probeTime = xstat_cm_Results.probeTime;
1047
    printTime = ctime(&probeTime);
1040
    printTime[strlen(printTime) - 1] = '\0';
1048
    printTime[strlen(printTime) - 1] = '\0';
1041
    hostname = xstat_cm_Results.connP->hostName;
1049
    hostname = xstat_cm_Results.connP->hostName;
1042
1050
(-)a/src/afsmonitor/afsmon-parselog.c (-2 / +3 lines)
Lines 318-324 Print_fs_FullPerfInfo(a_fs_Results) Link Here
318
    long numLongs;		/*# longwords received */
318
    long numLongs;		/*# longwords received */
319
    struct fs_stats_FullPerfStats *fullPerfP;	/*Ptr to full perf stats */
319
    struct fs_stats_FullPerfStats *fullPerfP;	/*Ptr to full perf stats */
320
    char *printableTime;	/*Ptr to printable time string */
320
    char *printableTime;	/*Ptr to printable time string */
321
321
    time_t probeTime;
322
322
323
    numLongs = a_fs_Results->data.AFS_CollData_len;
323
    numLongs = a_fs_Results->data.AFS_CollData_len;
324
    if (numLongs != fullPerfLongs) {
324
    if (numLongs != fullPerfLongs) {
Lines 327-333 Print_fs_FullPerfInfo(a_fs_Results) Link Here
327
	return;
327
	return;
328
    }
328
    }
329
329
330
    printableTime = ctime(&(a_fs_Results->probeTime));
330
    probeTime = a_fs_Results->probeTime;
331
    printableTime = ctime(&probeTime);
331
    printableTime[strlen(printableTime) - 1] = '\0';
332
    printableTime[strlen(printableTime) - 1] = '\0';
332
    fullPerfP = (struct fs_stats_FullPerfStats *)
333
    fullPerfP = (struct fs_stats_FullPerfStats *)
333
	(a_fs_Results->data.AFS_CollData_val);
334
	(a_fs_Results->data.AFS_CollData_val);
(-)a/src/afsweb/apache_afs_weblog.c (-1 / +1 lines)
Lines 91-97 get_time() Link Here
91
    char *time_string;
91
    char *time_string;
92
92
93
    t = time(NULL);
93
    t = time(NULL);
94
    time_string = (char *)ctime((time_t *) & t);
94
    time_string = (char *)ctime(&t);
95
    time_string[strlen(time_string) - 1] = '\0';
95
    time_string[strlen(time_string) - 1] = '\0';
96
    return (time_string);
96
    return (time_string);
97
}
97
}
(-)a/src/budb/struct_ops.c (-26 / +26 lines)
Lines 35-45 Link Here
35
 */
35
 */
36
36
37
void
37
void
38
printDbHeader(ptr)
38
printDbHeader(struct DbHeader *ptr)
39
     struct DbHeader *ptr;
40
{
39
{
40
    time_t created = ptr->created;
41
    printf("version = %d\n", ptr->dbversion);
41
    printf("version = %d\n", ptr->dbversion);
42
    printf("created = %s", ctime((time_t *) & ptr->created));
42
    printf("created = %s", ctime(&created));
43
    printf("cell = %s\n", ptr->cell);
43
    printf("cell = %s\n", ptr->cell);
44
    printf("lastDumpId = %u\n", ptr->lastDumpId);
44
    printf("lastDumpId = %u\n", ptr->lastDumpId);
45
    printf("lastInstanceId = %d\n", ptr->lastInstanceId);
45
    printf("lastInstanceId = %d\n", ptr->lastInstanceId);
Lines 47-56 printDbHeader(ptr) Link Here
47
}
47
}
48
48
49
void
49
void
50
printDump(fid, dptr)
50
printDump(FILE *fid, struct dump *dptr)
51
     FILE *fid;
52
     struct dump *dptr;
53
{
51
{
52
    time_t created = dptr->created;
54
    fprintf(fid, "id = %u\n", dptr->id);
53
    fprintf(fid, "id = %u\n", dptr->id);
55
    fprintf(fid, "idHashChain = %d\n", dptr->idHashChain);
54
    fprintf(fid, "idHashChain = %d\n", dptr->idHashChain);
56
    fprintf(fid, "name = %s\n", dptr->dumpName);
55
    fprintf(fid, "name = %s\n", dptr->dumpName);
Lines 59-65 printDump(fid, dptr) Link Here
59
    fprintf(fid, "nameHashChain = %d\n", dptr->nameHashChain);
58
    fprintf(fid, "nameHashChain = %d\n", dptr->nameHashChain);
60
    fprintf(fid, "flags = 0x%x\n", dptr->flags);
59
    fprintf(fid, "flags = 0x%x\n", dptr->flags);
61
    fprintf(fid, "parent = %u\n", dptr->parent);
60
    fprintf(fid, "parent = %u\n", dptr->parent);
62
    fprintf(fid, "created = %s", ctime((time_t *) & dptr->created));
61
    fprintf(fid, "created = %s", ctime(&created));
63
    fprintf(fid, "nVolumes = %d\n", dptr->nVolumes);
62
    fprintf(fid, "nVolumes = %d\n", dptr->nVolumes);
64
    /* printTapeSet(&dptr->tapes); */
63
    /* printTapeSet(&dptr->tapes); */
65
    fprintf(fid, "firstTape = %d\n", dptr->firstTape);
64
    fprintf(fid, "firstTape = %d\n", dptr->firstTape);
Lines 68-76 printDump(fid, dptr) Link Here
68
}
67
}
69
68
70
void
69
void
71
printDumpEntry(deptr)
70
printDumpEntry(struct budb_dumpEntry *deptr)
72
     struct budb_dumpEntry *deptr;
73
{
71
{
72
    time_t created = deptr->created;
74
    printf("id = %u\n", deptr->id);
73
    printf("id = %u\n", deptr->id);
75
    printf("Initial id = %u\n", deptr->initialDumpID);
74
    printf("Initial id = %u\n", deptr->initialDumpID);
76
    printf("Appended id = %u\n", deptr->appendedDumpID);
75
    printf("Appended id = %u\n", deptr->appendedDumpID);
Lines 95-101 printDumpEntry(deptr) Link Here
95
    printf("volumeSet = %s\n", deptr->volumeSetName);
94
    printf("volumeSet = %s\n", deptr->volumeSetName);
96
    printf("dump path = %s\n", deptr->dumpPath);
95
    printf("dump path = %s\n", deptr->dumpPath);
97
    printf("name = %s\n", deptr->name);
96
    printf("name = %s\n", deptr->name);
98
    printf("created = %s", ctime((time_t *) & deptr->created));
97
    printf("created = %s", ctime(&created));
99
    printf("nVolumes = %d\n", deptr->nVolumes);
98
    printf("nVolumes = %d\n", deptr->nVolumes);
100
99
101
    printTapeSet(&deptr->tapes, (deptr->flags & BUDB_DUMP_XBSA_NSS));
100
    printTapeSet(&deptr->tapes, (deptr->flags & BUDB_DUMP_XBSA_NSS));
Lines 158-171 printStructDumpHeader(ptr) Link Here
158
}
157
}
159
158
160
int
159
int
161
printTape(fid, tptr)
160
printTape(FILE *fid, struct tape *tptr)
162
     FILE *fid;
163
     struct tape *tptr;
164
{
161
{
162
    time_t written = tptr->written;
165
    fprintf(fid, "name = %s\n", tptr->name);
163
    fprintf(fid, "name = %s\n", tptr->name);
166
    fprintf(fid, "nameHashChain = %d\n", tptr->nameHashChain);
164
    fprintf(fid, "nameHashChain = %d\n", tptr->nameHashChain);
167
    fprintf(fid, "flags = 0x%x\n", tptr->flags);
165
    fprintf(fid, "flags = 0x%x\n", tptr->flags);
168
    fprintf(fid, "written = %s", ctime((time_t *) & tptr->written));
166
    fprintf(fid, "written = %s", ctime(&written));
169
    fprintf(fid, "nMBytes = %d\n", tptr->nMBytes);
167
    fprintf(fid, "nMBytes = %d\n", tptr->nMBytes);
170
    fprintf(fid, "nBytes = %d\n", tptr->nBytes);
168
    fprintf(fid, "nBytes = %d\n", tptr->nBytes);
171
    fprintf(fid, "nFiles = %d\n", tptr->nFiles);
169
    fprintf(fid, "nFiles = %d\n", tptr->nFiles);
Lines 180-188 printTape(fid, tptr) Link Here
180
}
178
}
181
179
182
int
180
int
183
printTapeEntry(teptr)
181
printTapeEntry(struct budb_tapeEntry *teptr)
184
     struct budb_tapeEntry *teptr;
185
{
182
{
183
    time_t written = teptr->written;
184
    time_t expires = teptr->expires;
185
186
    printf("name = %s\n", teptr->name);
186
    printf("name = %s\n", teptr->name);
187
    printf("flags = 0x%x", teptr->flags);
187
    printf("flags = 0x%x", teptr->flags);
188
    if (teptr->flags & BUDB_TAPE_TAPEERROR)
188
    if (teptr->flags & BUDB_TAPE_TAPEERROR)
Lines 198-205 printTapeEntry(teptr) Link Here
198
    if (teptr->flags & BUDB_TAPE_WRITTEN)
198
    if (teptr->flags & BUDB_TAPE_WRITTEN)
199
	printf(": Successful");
199
	printf(": Successful");
200
    printf("\n");
200
    printf("\n");
201
    printf("written = %s", ctime((time_t *) & teptr->written));
201
    printf("written = %s", ctime(&written));
202
    printf("expires = %s", cTIME((time_t *) & teptr->expires));
202
    printf("expires = %s", cTIME(&expires));
203
    printf("kBytes Tape Used = %u\n", teptr->useKBytes);
203
    printf("kBytes Tape Used = %u\n", teptr->useKBytes);
204
    printf("nMBytes Data = %d\n", teptr->nMBytes);
204
    printf("nMBytes Data = %d\n", teptr->nMBytes);
205
    printf("nBytes  Data = %d\n", teptr->nBytes);
205
    printf("nBytes  Data = %d\n", teptr->nBytes);
Lines 229-237 printTapeSet(tsptr, nss) Link Here
229
}
229
}
230
230
231
int
231
int
232
printVolumeEntry(veptr)
232
printVolumeEntry(struct budb_volumeEntry *veptr)
233
     struct budb_volumeEntry *veptr;
234
{
233
{
234
    time_t clone = veptr->clone;
235
    printf("name = %s\n", veptr->name);
235
    printf("name = %s\n", veptr->name);
236
    printf("flags = 0x%x", veptr->flags);
236
    printf("flags = 0x%x", veptr->flags);
237
    if (veptr->flags & BUDB_VOL_TAPEERROR)
237
    if (veptr->flags & BUDB_VOL_TAPEERROR)
Lines 253-259 printVolumeEntry(veptr) Link Here
253
    printf("tapeSeq = %d\n", veptr->tapeSeq);
253
    printf("tapeSeq = %d\n", veptr->tapeSeq);
254
254
255
    printf("position = %d\n", veptr->position);
255
    printf("position = %d\n", veptr->position);
256
    printf("clone = %s", ctime((time_t *) & veptr->clone));
256
    printf("clone = %s", ctime(&clone));
257
    printf("startByte = %d\n", veptr->startByte);
257
    printf("startByte = %d\n", veptr->startByte);
258
    printf("nBytes = %d\n", veptr->nBytes);
258
    printf("nBytes = %d\n", veptr->nBytes);
259
    printf("seq = %d\n", veptr->seq);
259
    printf("seq = %d\n", veptr->seq);
Lines 264-280 printVolumeEntry(veptr) Link Here
264
}
264
}
265
265
266
int
266
int
267
printVolFragment(fid, vfptr)
267
printVolFragment(FILE *fid, struct volFragment *vfptr)
268
     FILE *fid;
269
     struct volFragment *vfptr;
270
{
268
{
269
    time_t clone = vfptr->clone;
270
    time_t incTime = vfptr->incTime;
271
    fprintf(fid, "vol = %d\n", vfptr->vol);
271
    fprintf(fid, "vol = %d\n", vfptr->vol);
272
    fprintf(fid, "sameNameChain = %d\n", vfptr->sameNameChain);
272
    fprintf(fid, "sameNameChain = %d\n", vfptr->sameNameChain);
273
    fprintf(fid, "tape = %d\n", vfptr->tape);
273
    fprintf(fid, "tape = %d\n", vfptr->tape);
274
    fprintf(fid, "sameTapeChain = %d\n", vfptr->sameTapeChain);
274
    fprintf(fid, "sameTapeChain = %d\n", vfptr->sameTapeChain);
275
    fprintf(fid, "position = %d\n", vfptr->position);
275
    fprintf(fid, "position = %d\n", vfptr->position);
276
    fprintf(fid, "clone = %s", ctime((time_t *) & vfptr->clone));
276
    fprintf(fid, "clone = %s", ctime(&clone));
277
    fprintf(fid, "incTime = %s", ctime((time_t *) & vfptr->incTime));
277
    fprintf(fid, "incTime = %s", ctime(&incTime));
278
    fprintf(fid, "startByte = %d\n", vfptr->startByte);
278
    fprintf(fid, "startByte = %d\n", vfptr->startByte);
279
    fprintf(fid, "nBytes = %d\n", vfptr->nBytes);
279
    fprintf(fid, "nBytes = %d\n", vfptr->nBytes);
280
    fprintf(fid, "flags = %d\n", vfptr->flags);
280
    fprintf(fid, "flags = %d\n", vfptr->flags);
(-)a/src/cf/linux-test4.m4 (-3 / +49 lines)
Lines 467-472 printk("%p\n", _super.alloc_inode);], Link Here
467
  AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_alloc_inode)])
467
  AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_alloc_inode)])
468
468
469
469
470
AC_DEFUN([LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE], [
471
  AC_MSG_CHECKING([for evict_inode in struct super_operations])
472
  AC_CACHE_VAL([ac_cv_linux_fs_struct_super_has_evict_inode], [
473
    AC_TRY_KBUILD(
474
[#include <linux/fs.h>],
475
[struct super_operations _super;
476
printk("%p\n", _super.evict_inode);],
477
      ac_cv_linux_fs_struct_super_has_evict_inode=yes,
478
      ac_cv_linux_fs_struct_super_has_evict_inode=no)])
479
  AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_evict_inode)])
480
481
470
AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
482
AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
471
  AC_MSG_CHECKING([for 3rd argument in posix_lock_file found in new kernels])
483
  AC_MSG_CHECKING([for 3rd argument in posix_lock_file found in new kernels])
472
  AC_CACHE_VAL([ac_cv_linux_kernel_posix_lock_file_wait_arg], [
484
  AC_CACHE_VAL([ac_cv_linux_kernel_posix_lock_file_wait_arg], [
Lines 722-730 AC_DEFUN([LINUX_STATFS_TAKES_DENTRY], [ Link Here
722
    AC_TRY_KBUILD(
734
    AC_TRY_KBUILD(
723
[#include <linux/fs.h>
735
[#include <linux/fs.h>
724
#include <linux/statfs.h>],
736
#include <linux/statfs.h>],
725
[
737
[struct super_block _sb;
726
extern int vfs_statfs(struct dentry *, struct kstatfs *);
738
struct dentry _dentry;
727
],
739
struct kstatfs _kstatfs;
740
(void)_sb.s_op->statfs(&_dentry, &_kstatfs);],
728
      ac_cv_linux_statfs_takes_dentry=yes,
741
      ac_cv_linux_statfs_takes_dentry=yes,
729
      ac_cv_linux_statfs_takes_dentry=no)])
742
      ac_cv_linux_statfs_takes_dentry=no)])
730
  AC_MSG_RESULT($ac_cv_linux_statfs_takes_dentry)])
743
  AC_MSG_RESULT($ac_cv_linux_statfs_takes_dentry)])
Lines 929-934 fl_owner_t id; Link Here
929
      ac_cv_linux_func_f_flush_takes_fl_owner_t=no)])
942
      ac_cv_linux_func_f_flush_takes_fl_owner_t=no)])
930
  AC_MSG_RESULT($ac_cv_linux_func_f_flush_takes_fl_owner_t)])
943
  AC_MSG_RESULT($ac_cv_linux_func_f_flush_takes_fl_owner_t)])
931
944
945
AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [
946
  AC_MSG_CHECKING([whether file_operations.fsync takes a dentry argument])
947
  AC_CACHE_VAL([ac_cv_linux_func_f_fsync_takes_dentry], [
948
    AC_TRY_KBUILD(
949
[#include <linux/fs.h>],
950
[struct inode _inode;
951
struct file _file;
952
struct dentry _d;
953
(void)_inode.i_fop->fsync(&_file, &_d, 0);],
954
      ac_cv_linux_func_f_fsync_takes_dentry=yes,
955
      ac_cv_linux_func_f_fsync_takes_dentry=no)])
956
  AC_MSG_RESULT($ac_cv_linux_func_f_fsync_takes_dentry)
957
  if test "x$ac_cv_linux_func_f_fsync_takes_dentry" = "xyes"; then
958
    AC_DEFINE([FOP_FSYNC_TAKES_DENTRY], 1, [define if your fops.fsync takes an dentry argument])
959
  fi
960
])
961
932
AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
962
AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
933
  AC_MSG_CHECKING([whether kmem_cache_t exists])
963
  AC_MSG_CHECKING([whether kmem_cache_t exists])
934
  AC_CACHE_VAL([ac_cv_linux_have_kmem_cache_t], [
964
  AC_CACHE_VAL([ac_cv_linux_have_kmem_cache_t], [
Lines 1261-1263 _bdi.name = NULL;], Link Here
1261
  if test "x$ac_cv_linux_struct_bdi_has_name" = "xyes"; then
1291
  if test "x$ac_cv_linux_struct_bdi_has_name" = "xyes"; then
1262
    AC_DEFINE([STRUCT_BDI_HAS_NAME], 1, [define if struct backing_dev_info has a name member])
1292
    AC_DEFINE([STRUCT_BDI_HAS_NAME], 1, [define if struct backing_dev_info has a name member])
1263
  fi])
1293
  fi])
1294
1295
AC_DEFUN([LINUX_HAVE_INODE_SETATTR], [
1296
  AC_MSG_CHECKING([for linux inode_setattr()])
1297
  AC_CACHE_VAL([ac_cv_linux_inode_setattr], [
1298
    save_CPPFLAGS="$CPPFLAGS"
1299
    CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
1300
    AC_TRY_KBUILD(
1301
[#include <linux/fs.h>],
1302
[inode_setattr(NULL);],
1303
      ac_cv_linux_inode_setattr=yes,
1304
      ac_cv_linux_inode_setattr=no)
1305
    CPPFLAGS="$save_CPPFLAGS"])
1306
  AC_MSG_RESULT($ac_cv_linux_inode_setattr)
1307
  if test "x$ac_cv_linux_inode_setattr" = "xyes"; then
1308
    AC_DEFINE([HAVE_LINUX_INODE_SETATTR], 1, [define if your kernel has inode_setattr()])
1309
  fi])
(-)a/src/config/afs_sysnames.h (+12 lines)
Lines 289-294 Link Here
289
#define SYS_NAME_ID_i386_dfbsd_22        3900
289
#define SYS_NAME_ID_i386_dfbsd_22        3900
290
#define SYS_NAME_ID_i386_dfbsd_23        3901
290
#define SYS_NAME_ID_i386_dfbsd_23        3901
291
291
292
#define SYS_NAME_ID_amd64_obsd36        4005
293
#define SYS_NAME_ID_amd64_obsd37        4006
294
#define SYS_NAME_ID_amd64_obsd38        4007
295
#define SYS_NAME_ID_amd64_obsd39        4008
296
#define SYS_NAME_ID_amd64_obsd40        4009
297
#define SYS_NAME_ID_amd64_obsd41        4010
298
#define SYS_NAME_ID_amd64_obsd42        4011
299
#define SYS_NAME_ID_amd64_obsd43        4012
300
#define SYS_NAME_ID_amd64_obsd44        4013
301
#define SYS_NAME_ID_amd64_obsd45        4014
302
#define SYS_NAME_ID_amd64_obsd46        4015
303
292
/*
304
/*
293
 * Placeholder to keep system-wide standard flags since this file is included by all 
305
 * Placeholder to keep system-wide standard flags since this file is included by all 
294
 * files (i.e in afs/param.h)
306
 * files (i.e in afs/param.h)
(-)a/src/config/param.amd64_obsd45.h (+75 lines)
Line 0 Link Here
1
/*
2
 * Thanks to Jim Rees and University of Michigan CITI, for the initial
3
 * OpenBSD porting work.
4
 */
5
6
#ifndef	AFS_PARAM_H
7
#define	AFS_PARAM_H
8
9
#ifndef IGNORE_STDS_H
10
#include <sys/param.h>
11
#endif
12
13
#define SYS_NAME		"amd64_obsd45"
14
#define SYS_NAME_ID		SYS_NAME_ID_amd64_obsd45
15
16
#define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
17
#define AFS_X86_XBSD_ENV	1
18
19
#define AFS_NAMEI_ENV		1	/* User space interface to file system */
20
#define AFS_64BIT_ENV		1
21
#define AFS_64BITPOINTER_ENV    1
22
#define AFS_64BIT_CLIENT	1
23
#define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
24
#define AFS_OBSD_ENV		1
25
#define AFS_OBSD34_ENV		1
26
#define AFS_OBSD35_ENV		1
27
#define AFS_OBSD36_ENV		1
28
#define AFS_OBSD37_ENV		1
29
#define AFS_OBSD38_ENV		1
30
#define AFS_OBSD39_ENV		1
31
#define AFS_OBSD40_ENV		1
32
#define AFS_OBSD41_ENV		1
33
#define AFS_OBSD42_ENV		1
34
#define AFS_OBSD43_ENV		1
35
#define AFS_OBSD44_ENV		1
36
#define AFS_OBSD45_ENV		1
37
#define AFS_NONFSTRANS		1
38
#define AFS_VM_RDWR_ENV		1
39
#define AFS_VFS_ENV		1
40
#define AFS_VFSINCL_ENV		1
41
42
#define FTRUNC O_TRUNC
43
44
#define AFS_SYSCALL		208
45
#define AFS_MOUNT_AFS		"afs"
46
47
#define RXK_LISTENER_ENV	1
48
#define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
49
#define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
50
51
#define AFSLITTLE_ENDIAN	1
52
53
#ifndef IGNORE_STDS_H
54
#include <afs/afs_sysnames.h>
55
#endif
56
57
/* Extra kernel definitions (from kdefs file) */
58
#ifdef _KERNEL
59
#define AFS_GLOBAL_SUNLOCK	1
60
#define	AFS_SHORTGID		0	/* are group id's short? */
61
62
#if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
63
enum vcexcl { NONEXCL, EXCL };
64
65
#ifndef MIN
66
#define MIN(A,B) ((A) < (B) ? (A) : (B))
67
#endif
68
#ifndef MAX
69
#define MAX(A,B) ((A) > (B) ? (A) : (B))
70
#endif
71
72
#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
73
#endif /* _KERNEL */
74
75
#endif /* AFS_PARAM_H */
(-)a/src/config/param.amd64_obsd46.h (+76 lines)
Line 0 Link Here
1
/*
2
 * Thanks to Jim Rees and University of Michigan CITI, for the initial
3
 * OpenBSD porting work.
4
 */
5
6
#ifndef	AFS_PARAM_H
7
#define	AFS_PARAM_H
8
9
#ifndef IGNORE_STDS_H
10
#include <sys/param.h>
11
#endif
12
13
#define SYS_NAME		"amd64_obsd46"
14
#define SYS_NAME_ID		SYS_NAME_ID_amd64_obsd46
15
16
#define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
17
#define AFS_X86_XBSD_ENV	1
18
19
#define AFS_NAMEI_ENV		1	/* User space interface to file system */
20
#define AFS_64BIT_ENV		1
21
#define AFS_64BITPOINTER_ENV    1
22
#define AFS_64BIT_CLIENT	1
23
#define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
24
#define AFS_OBSD_ENV		1
25
#define AFS_OBSD34_ENV		1
26
#define AFS_OBSD35_ENV		1
27
#define AFS_OBSD36_ENV		1
28
#define AFS_OBSD37_ENV		1
29
#define AFS_OBSD38_ENV		1
30
#define AFS_OBSD39_ENV		1
31
#define AFS_OBSD40_ENV		1
32
#define AFS_OBSD41_ENV		1
33
#define AFS_OBSD42_ENV		1
34
#define AFS_OBSD43_ENV		1
35
#define AFS_OBSD44_ENV		1
36
#define AFS_OBSD45_ENV		1
37
#define AFS_OBSD46_ENV		1
38
#define AFS_NONFSTRANS		1
39
#define AFS_VM_RDWR_ENV		1
40
#define AFS_VFS_ENV		1
41
#define AFS_VFSINCL_ENV		1
42
43
#define FTRUNC O_TRUNC
44
45
#define AFS_SYSCALL		208
46
#define AFS_MOUNT_AFS		"afs"
47
48
#define RXK_LISTENER_ENV	1
49
#define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
50
#define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
51
52
#define AFSLITTLE_ENDIAN	1
53
54
#ifndef IGNORE_STDS_H
55
#include <afs/afs_sysnames.h>
56
#endif
57
58
/* Extra kernel definitions (from kdefs file) */
59
#ifdef _KERNEL
60
#define AFS_GLOBAL_SUNLOCK	1
61
#define	AFS_SHORTGID		0	/* are group id's short? */
62
63
#if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
64
enum vcexcl { NONEXCL, EXCL };
65
66
#ifndef MIN
67
#define MIN(A,B) ((A) < (B) ? (A) : (B))
68
#endif
69
#ifndef MAX
70
#define MAX(A,B) ((A) > (B) ? (A) : (B))
71
#endif
72
73
#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
74
#endif /* _KERNEL */
75
76
#endif /* AFS_PARAM_H */
(-)a/src/config/param.i386_obsd42.h (+72 lines)
Line 0 Link Here
1
/*
2
 * Jim Rees, University of Michigan CITI
3
 */
4
5
#ifndef	AFS_PARAM_H
6
#define	AFS_PARAM_H
7
8
#ifndef IGNORE_STDS_H
9
#include <sys/param.h>
10
#endif
11
12
#define SYS_NAME		"i386_obsd42"
13
#define SYS_NAME_ID		SYS_NAME_ID_i386_obsd42
14
15
#define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
16
#define AFS_X86_XBSD_ENV	1
17
18
#define AFS_NAMEI_ENV		1	/* User space interface to file system */
19
#define AFS_64BIT_ENV		1
20
#define AFS_64BIT_CLIENT	1
21
#define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
22
#define AFS_OBSD_ENV		1
23
#define AFS_OBSD34_ENV		1
24
#define AFS_OBSD35_ENV		1
25
#define AFS_OBSD36_ENV		1
26
#define AFS_OBSD37_ENV		1
27
#define AFS_OBSD38_ENV		1
28
#define AFS_OBSD39_ENV		1
29
#define AFS_OBSD40_ENV		1
30
#define AFS_OBSD41_ENV		1
31
#define AFS_OBSD42_ENV		1
32
#define AFS_NONFSTRANS		1
33
#define AFS_VM_RDWR_ENV		1
34
#define AFS_VFS_ENV		1
35
#define AFS_VFSINCL_ENV		1
36
37
#define FTRUNC O_TRUNC
38
39
#define AFS_SYSCALL		208
40
#define AFS_MOUNT_AFS		"afs"
41
42
#define RXK_LISTENER_ENV	1
43
#define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
44
#define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
45
46
#define AFSLITTLE_ENDIAN	1
47
48
#ifndef IGNORE_STDS_H
49
#include <afs/afs_sysnames.h>
50
#endif
51
52
/* Extra kernel definitions (from kdefs file) */
53
#ifdef _KERNEL
54
#ifdef MULTIPROCESSOR
55
#define AFS_GLOBAL_SUNLOCK	1
56
#endif
57
#define	AFS_SHORTGID		0	/* are group id's short? */
58
59
#if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
60
enum vcexcl { NONEXCL, EXCL };
61
62
#ifndef MIN
63
#define MIN(A,B) ((A) < (B) ? (A) : (B))
64
#endif
65
#ifndef MAX
66
#define MAX(A,B) ((A) > (B) ? (A) : (B))
67
#endif
68
69
#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
70
#endif /* _KERNEL */
71
72
#endif /* AFS_PARAM_H */
(-)a/src/config/param.i386_obsd43.h (+73 lines)
Line 0 Link Here
1
/*
2
 * Jim Rees, University of Michigan CITI
3
 */
4
5
#ifndef	AFS_PARAM_H
6
#define	AFS_PARAM_H
7
8
#ifndef IGNORE_STDS_H
9
#include <sys/param.h>
10
#endif
11
12
#define SYS_NAME		"i386_obsd43"
13
#define SYS_NAME_ID		SYS_NAME_ID_i386_obsd43
14
15
#define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
16
#define AFS_X86_XBSD_ENV	1
17
18
#define AFS_NAMEI_ENV		1	/* User space interface to file system */
19
#define AFS_64BIT_ENV		1
20
#define AFS_64BIT_CLIENT	1
21
#define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
22
#define AFS_OBSD_ENV		1
23
#define AFS_OBSD34_ENV		1
24
#define AFS_OBSD35_ENV		1
25
#define AFS_OBSD36_ENV		1
26
#define AFS_OBSD37_ENV		1
27
#define AFS_OBSD38_ENV		1
28
#define AFS_OBSD39_ENV		1
29
#define AFS_OBSD40_ENV		1
30
#define AFS_OBSD41_ENV		1
31
#define AFS_OBSD42_ENV		1
32
#define AFS_OBSD43_ENV		1
33
#define AFS_NONFSTRANS		1
34
#define AFS_VM_RDWR_ENV		1
35
#define AFS_VFS_ENV		1
36
#define AFS_VFSINCL_ENV		1
37
38
#define FTRUNC O_TRUNC
39
40
#define AFS_SYSCALL		208
41
#define AFS_MOUNT_AFS		"afs"
42
43
#define RXK_LISTENER_ENV	1
44
#define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
45
#define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
46
47
#define AFSLITTLE_ENDIAN	1
48
49
#ifndef IGNORE_STDS_H
50
#include <afs/afs_sysnames.h>
51
#endif
52
53
/* Extra kernel definitions (from kdefs file) */
54
#ifdef _KERNEL
55
#ifdef MULTIPROCESSOR
56
#define AFS_GLOBAL_SUNLOCK	1
57
#endif
58
#define	AFS_SHORTGID		0	/* are group id's short? */
59
60
#if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
61
enum vcexcl { NONEXCL, EXCL };
62
63
#ifndef MIN
64
#define MIN(A,B) ((A) < (B) ? (A) : (B))
65
#endif
66
#ifndef MAX
67
#define MAX(A,B) ((A) > (B) ? (A) : (B))
68
#endif
69
70
#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
71
#endif /* _KERNEL */
72
73
#endif /* AFS_PARAM_H */
(-)a/src/config/param.i386_obsd45.h (-1 / +2 lines)
Lines 1-5 Link Here
1
/*
1
/*
2
 * Jim Rees, University of Michigan CITI
2
 * Thanks to Jim Rees and University of Michigan CITI, for the initial
3
 * OpenBSD porting work.
3
 */
4
 */
4
5
5
#ifndef	AFS_PARAM_H
6
#ifndef	AFS_PARAM_H
(-)a/src/config/stds.h (-2 / +4 lines)
Lines 271-278 typedef struct afsUUID afsUUID; Link Here
271
#define static_inline __inline static
271
#define static_inline __inline static
272
#define hdr_static_inline(x) __inline static x
272
#define hdr_static_inline(x) __inline static x
273
#elif defined(AFS_HPUX_ENV) || defined(AFS_USR_HPUX_ENV)
273
#elif defined(AFS_HPUX_ENV) || defined(AFS_USR_HPUX_ENV)
274
#define static_inline static __inline
274
/* The HPUX compiler can segfault on 'static __inline', so fall back to
275
#define hdr_static_inline(x) static __inline x
275
 * just 'static' so we can at least compile */
276
#define static_inline static
277
#define hdr_static_inline(x) static x
276
#elif defined(AFS_AIX_ENV) || defined(AFS_USR_AIX_ENV)
278
#elif defined(AFS_AIX_ENV) || defined(AFS_USR_AIX_ENV)
277
#define static_inline static
279
#define static_inline static
278
#define hdr_static_inline(x) static x
280
#define hdr_static_inline(x) static x
(-)a/src/kauth/rebuild.c (-3 / +6 lines)
Lines 116-121 PrintEntry(index, entry) Link Here
116
    char Time[100];
116
    char Time[100];
117
    struct tm *tm_p;
117
    struct tm *tm_p;
118
    time_t tt;
118
    time_t tt;
119
    time_t modification_time = entry->modification_time;
120
    time_t change_password_time = entry->change_password_time;
121
    time_t max_ticket_lifetime = entry->max_ticket_lifetime;
119
122
120
    printf("\n");
123
    printf("\n");
121
124
Lines 196-207 PrintEntry(index, entry) Link Here
196
	   (!entry->pwsums[0] && !entry->pwsums[1]) ? "yes" : "no");
199
	   (!entry->pwsums[0] && !entry->pwsums[1]) ? "yes" : "no");
197
200
198
    printf("   Mod Time = %u: %s", entry->modification_time,
201
    printf("   Mod Time = %u: %s", entry->modification_time,
199
	   ctime((time_t *) & entry->modification_time));
202
	   ctime(&modification_time));
200
    printf("   Mod ID = %u\n", entry->modification_id);
203
    printf("   Mod ID = %u\n", entry->modification_id);
201
    printf("   Change Password Time = %u: %s", entry->change_password_time,
204
    printf("   Change Password Time = %u: %s", entry->change_password_time,
202
	   ctime((time_t *) & entry->change_password_time));
205
	   ctime(&change_password_time));
203
    printf("   Ticket lifetime = %u: %s", entry->max_ticket_lifetime,
206
    printf("   Ticket lifetime = %u: %s", entry->max_ticket_lifetime,
204
	   ctime((time_t *) & entry->max_ticket_lifetime));
207
	   ctime(&max_ticket_lifetime));
205
    printf("   Key Version = %d\n", entry->key_version);
208
    printf("   Key Version = %d\n", entry->key_version);
206
209
207
    printf("   Key = ");
210
    printf("   Key = ");
(-)a/src/package/update.c (-1 / +2 lines)
Lines 382-389 dochtim(CTREEPTR np, char *path) Link Here
382
    tm[0].tv_usec = tm[1].tv_usec = 0;
382
    tm[0].tv_usec = tm[1].tv_usec = 0;
383
    if (!opt_silent) {
383
    if (!opt_silent) {
384
	char *date;
384
	char *date;
385
	time_t mtime = np->mtime;
385
386
386
	date = ctime((time_t *) & np->mtime);
387
	date = ctime(&mtime);
387
	date[24] = 0;
388
	date[24] = 0;
388
	loudonly_message("utimes %s [%s]", path, date);
389
	loudonly_message("utimes %s [%s]", path, date);
389
    }
390
    }
(-)a/src/packaging/RedHat/openafs-kmodtool (-2 / +5 lines)
Lines 40-45 get_verrel () Link Here
40
  verrel=${1:-$(uname -r)}
40
  verrel=${1:-$(uname -r)}
41
  verrel=${verrel%%$knownvariants}
41
  verrel=${verrel%%$knownvariants}
42
  case "$verrel" in
42
  case "$verrel" in
43
    *.el6*)  verrel="`echo ${verrel} | sed -e 's/^\(.*.el6[^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
43
    *.fc9*)  verrel="`echo ${verrel} | sed -e 's/^\(.*.fc9[^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
44
    *.fc9*)  verrel="`echo ${verrel} | sed -e 's/^\(.*.fc9[^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
44
    *.fc1?*) verrel="`echo ${verrel} | sed -e 's/^\(.*.fc1[0-9][^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
45
    *.fc1?*) verrel="`echo ${verrel} | sed -e 's/^\(.*.fc1[0-9][^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
45
  esac
46
  esac
Lines 71-83 get_rpmtemplate () Link Here
71
    local variant="${1}"
72
    local variant="${1}"
72
    local dashvariant="${variant:+-${variant}}"
73
    local dashvariant="${variant:+-${variant}}"
73
    case "$verrel" in
74
    case "$verrel" in
75
        *.el6*) kdep="kernel-%{_target_cpu} = ${verrel}${variant}"     ;;
74
        *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
76
        *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
75
        *)     kdep="kernel-%{_target_cpu} = ${verrel}${variant}"     ;;
77
        *)     kdep="kernel-%{_target_cpu} = ${verrel}${variant}"     ;;
76
    esac
78
    esac
77
    case "$verrel" in
79
    case "$verrel" in
78
        *.fc9*) kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
80
        *.el6*)   kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
81
        *.fc9*)   kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
79
        *.fc1?*)  kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
82
        *.fc1?*)  kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
80
        *)      kname="${verrel}${variant}"                             ;;
83
        *)        kname="${verrel}${variant}"                             ;;
81
    esac
84
    esac
82
85
83
    cat <<EOF
86
    cat <<EOF
(-)a/src/packaging/RedHat/openafs.spec.in (-23 / +31 lines)
Lines 102-113 Link Here
102
# to distribute aklog and asetkey
102
# to distribute aklog and asetkey
103
%define krb5support %{?_without_krb5:0}%{!?_without_krb5:1}
103
%define krb5support %{?_without_krb5:0}%{!?_without_krb5:1}
104
104
105
%if %{krb5support}
106
%if %{?krb5config:0}%{!?krb5config:1}
107
%define krb5config /usr/kerberos/bin/krb5-config
108
%endif
109
%endif
110
111
# Set 'bootkernelsupport' to 1 if you want to build the
105
# Set 'bootkernelsupport' to 1 if you want to build the
112
# kernel module for Red Hat BOOT Kernels on x86.
106
# kernel module for Red Hat BOOT Kernels on x86.
113
%define bootkernelsupport %{?_with_bootkernel:1}%{!?_with_bootkernel:0}
107
%define bootkernelsupport %{?_with_bootkernel:1}%{!?_with_bootkernel:0}
Lines 343-349 To a kernel module for your running kernel, just run: Link Here
343
%if %{build_userspace}
337
%if %{build_userspace}
344
338
345
%package client
339
%package client
346
Requires: binutils, openafs = %{PACKAGE_VERSION}
340
Requires: binutils, openafs = %{version}
347
341
348
%if %{fedorakmod}
342
%if %{fedorakmod}
349
Requires: %{name}-kmod >= %{version}
343
Requires: %{name}-kmod >= %{version}
Lines 365-371 This package provides basic client support to mount and manipulate Link Here
365
AFS.
359
AFS.
366
360
367
%package server
361
%package server
368
Requires: openafs = %{PACKAGE_VERSION}
362
Requires: openafs = %{version}
369
Summary: OpenAFS Filesystem Server
363
Summary: OpenAFS Filesystem Server
370
Group: Networking/Filesystems
364
Group: Networking/Filesystems
371
365
Lines 382-390 Cell. Link Here
382
%package -n dkms-%{name}
376
%package -n dkms-%{name}
383
Summary:        DKMS-ready kernel source for AFS distributed filesystem
377
Summary:        DKMS-ready kernel source for AFS distributed filesystem
384
Group:          Development/Kernel
378
Group:          Development/Kernel
385
Provides:       openafs-kernel = %{PACKAGE_VERSION}
379
Provides:       openafs-kernel = %{version}
386
%if %{fedorakmod}
380
%if %{fedorakmod}
387
Provides: %{name}-kmod = %{PACKAGE_VERSION}
381
Provides: %{name}-kmod = %{version}
388
%endif
382
%endif
389
Requires(pre):  dkms
383
Requires(pre):  dkms
390
Requires(pre):  flex
384
Requires(pre):  flex
Lines 420-428 authentication may link against them. Link Here
420
414
421
%package authlibs-devel
415
%package authlibs-devel
422
%if %{build_authlibs}
416
%if %{build_authlibs}
423
Requires: openafs-authlibs = %{PACKAGE_VERSION}
417
Requires: openafs-authlibs = %{version}
424
%endif
418
%endif
425
Requires: openafs-devel = %{PACKAGE_VERSION}
419
Requires: openafs-devel = %{version}
426
Summary: OpenAFS shared library development
420
Summary: OpenAFS shared library development
427
Group: Development/Filesystems
421
Group: Development/Filesystems
428
422
Lines 452-458 shared libraries. Link Here
452
446
453
%package docs
447
%package docs
454
Summary: OpenAFS user and administrator documentation
448
Summary: OpenAFS user and administrator documentation
455
Requires: openafs = %{PACKAGE_VERSION}
449
Requires: openafs = %{version}
456
Group: Networking/Filesystems
450
Group: Networking/Filesystems
457
451
458
%description docs
452
%description docs
Lines 467-475 administrators. Link Here
467
%package kernel-source
461
%package kernel-source
468
Summary: OpenAFS Kernel Module source tree
462
Summary: OpenAFS Kernel Module source tree
469
Group: Networking/Filesystems
463
Group: Networking/Filesystems
470
Provides: openafs-kernel = %{PACKAGE_VERSION}
464
Provides: openafs-kernel = %{version}
471
%if %{fedorakmod}
465
%if %{fedorakmod}
472
Provides: %{name}-kmod = %{PACKAGE_VERSION}
466
Provides: %{name}-kmod = %{version}
473
%endif
467
%endif
474
468
475
%description kernel-source
469
%description kernel-source
Lines 483-489 module. Link Here
483
477
484
%package compat
478
%package compat
485
Summary: OpenAFS client compatibility symlinks
479
Summary: OpenAFS client compatibility symlinks
486
Requires: openafs = %{PACKAGE_VERSION}, openafs-client = %{PACKAGE_VERSION}
480
Requires: openafs = %{version}, openafs-client = %{version}
487
Group: Networking/Filesystems
481
Group: Networking/Filesystems
488
Obsoletes: openafs-client-compat
482
Obsoletes: openafs-client-compat
489
483
Lines 515-521 you are using KAserver instead of Krb5. Link Here
515
%if %{krb5support}
509
%if %{krb5support}
516
%package krb5
510
%package krb5
517
Summary: OpenAFS programs to use with krb5
511
Summary: OpenAFS programs to use with krb5
518
Requires: openafs = %{PACKAGE_VERSION}
512
Requires: openafs = %{version}
519
Group: Networking/Filesystems
513
Group: Networking/Filesystems
520
BuildRequires: krb5-devel
514
BuildRequires: krb5-devel
521
515
Lines 554-560 krb4 lookalike services. Link Here
554
Summary: OpenAFS Kernel Module (compiled for UP)
548
Summary: OpenAFS Kernel Module (compiled for UP)
555
Release: %{modpkgrel}
549
Release: %{modpkgrel}
556
Group: Networking/Filesystems
550
Group: Networking/Filesystems
557
Provides: openafs-kernel = %{PACKAGE_VERSION}
551
Provides: openafs-kernel = %{version}
558
%if %{kprovidesarch}
552
%if %{kprovidesarch}
559
Requires: kernel-%{_target_cpu} = %{kversion}
553
Requires: kernel-%{_target_cpu} = %{kversion}
560
%else
554
%else
Lines 574-580 This package provides a precompiled AFS kernel module for %{kernvers}. Link Here
574
%package kernel-smp
568
%package kernel-smp
575
Summary: OpenAFS Kernel Module (compiled for SMP)
569
Summary: OpenAFS Kernel Module (compiled for SMP)
576
Release: %{modpkgrel}
570
Release: %{modpkgrel}
577
Provides: openafs-kernel = %{PACKAGE_VERSION}
571
Provides: openafs-kernel = %{version}
578
%if %{kprovidesarch}
572
%if %{kprovidesarch}
579
Requires: kernel-smp-%{_target_cpu} = %{kversion}
573
Requires: kernel-smp-%{_target_cpu} = %{kversion}
580
%else
574
%else
Lines 595-601 This package provides a precompiled AFS kernel module for %{kernvers}. Link Here
595
%package kernel-largesmp
589
%package kernel-largesmp
596
Summary: OpenAFS Kernel Module (compiled for LARGESMP)
590
Summary: OpenAFS Kernel Module (compiled for LARGESMP)
597
Release: %{modpkgrel}
591
Release: %{modpkgrel}
598
Provides: openafs-kernel = %{PACKAGE_VERSION}
592
Provides: openafs-kernel = %{version}
599
%if %{kprovidesarch}
593
%if %{kprovidesarch}
600
Requires: kernel-largesmp-%{_target_cpu} = %{kversion}
594
Requires: kernel-largesmp-%{_target_cpu} = %{kversion}
601
%else
595
%else
Lines 616-622 This package provides a precompiled AFS kernel module for %{kernvers}. Link Here
616
%package kernel-bigmem
610
%package kernel-bigmem
617
Summary: OpenAFS Kernel Module (compiled for SMP & big memory support)
611
Summary: OpenAFS Kernel Module (compiled for SMP & big memory support)
618
Release: %{modpkgrel}
612
Release: %{modpkgrel}
619
Provides: openafs-kernel = %{PACKAGE_VERSION}
613
Provides: openafs-kernel = %{version}
620
%if %{kprovidesarch}
614
%if %{kprovidesarch}
621
Requires: kernel-bigmem-%{_target_cpu} = %{kversion}
615
Requires: kernel-bigmem-%{_target_cpu} = %{kversion}
622
%else
616
%else
Lines 637-643 This package provides a precompiled AFS kernel module for %{kernvers}. Link Here
637
%package kernel-hugemem
631
%package kernel-hugemem
638
Summary: OpenAFS Kernel Module (compiled for SMP & huge memory support)
632
Summary: OpenAFS Kernel Module (compiled for SMP & huge memory support)
639
Release: %{modpkgrel}
633
Release: %{modpkgrel}
640
Provides: openafs-kernel = %{PACKAGE_VERSION}
634
Provides: openafs-kernel = %{version}
641
%if %{kprovidesarch}
635
%if %{kprovidesarch}
642
Requires: kernel-hugemem-%{_target_cpu} = %{kversion}
636
Requires: kernel-hugemem-%{_target_cpu} = %{kversion}
643
%else
637
%else
Lines 862-867 fi Link Here
862
856
863
CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
857
CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
864
858
859
%if %{krb5support}
860
%if %{?krb5config:0}%{!?krb5config:1}
861
if [ -x /usr/kerberos/bin/krb5-config ] ; then
862
  KRB5_CONFIG=/usr/kerberos/bin/krb5-config
863
else
864
  KRB5_CONFIG=/usr/bin/krb5-config
865
fi
866
%else
867
KRB5_CONFIG="%{krb5config}"
868
%endif
869
%endif
870
865
./configure --with-afs-sysname=${sysname} \
871
./configure --with-afs-sysname=${sysname} \
866
       --prefix=%{_prefix} \
872
       --prefix=%{_prefix} \
867
       --libdir=%{_libdir} \
873
       --libdir=%{_libdir} \
Lines 872-878 CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS Link Here
872
       --with-linux-kernel-headers=${ksrc} \
878
       --with-linux-kernel-headers=${ksrc} \
873
%endif
879
%endif
874
%if %{krb5support}
880
%if %{krb5support}
875
	--with-krb5-conf=%{krb5config} \
881
	--with-krb5-conf="$KRB5_CONFIG" \
876
%endif
882
%endif
877
       $config_opts \
883
       $config_opts \
878
       || exit 1
884
       || exit 1
Lines 1537-1542 dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||: Link Here
1537
%defattr(-,root,root)
1543
%defattr(-,root,root)
1538
%{_libdir}/libafsauthent.a
1544
%{_libdir}/libafsauthent.a
1539
%{_libdir}/libafsrpc.a
1545
%{_libdir}/libafsrpc.a
1546
%{_libdir}/libafsauthent_pic.a
1547
%{_libdir}/libafsrpc_pic.a
1540
%if %{build_authlibs}
1548
%if %{build_authlibs}
1541
%{_libdir}/libafsauthent.so
1549
%{_libdir}/libafsauthent.so
1542
%{_libdir}/libafsrpc.so
1550
%{_libdir}/libafsrpc.so
(-)a/src/ptserver/db_verify.c (-40 lines)
Lines 1179-1187 DumpRecreate(char map[], struct misc_data *misc) Link Here
1179
	    if ((id < 0) && (flags & PRGRP)) {
1179
	    if ((id < 0) && (flags & PRGRP)) {
1180
		int count = 0;
1180
		int count = 0;
1181
		afs_int32 na;
1181
		afs_int32 na;
1182
#if defined(SUPERGROUPS)
1183
		afs_int32 ng;
1184
#endif
1185
		int i;
1182
		int i;
1186
		for (i = 0; i < PRSIZE; i++) {
1183
		for (i = 0; i < PRSIZE; i++) {
1187
		    afs_int32 uid = ntohl(e.entries[i]);
1184
		    afs_int32 uid = ntohl(e.entries[i]);
Lines 1200-1242 DumpRecreate(char map[], struct misc_data *misc) Link Here
1200
				id);
1197
				id);
1201
#endif
1198
#endif
1202
		}
1199
		}
1203
#if defined(SUPERGROUPS)
1204
#define g	(*((struct prentryg *)&e))
1205
		ng = ntohl(g.nextsg);
1206
		for (i = 0; i < SGSIZE; i++) {
1207
		    afs_int32 uid = ntohl(g.supergroup[i]);
1208
		    if (uid == 0)
1209
			break;
1210
		    if (uid == PRBADID)
1211
			continue;
1212
		    fprintf(rc, "au %d %d\n", uid, id);
1213
		    count++;
1214
		}
1215
		while (ng) {
1216
		    struct prentry c;
1217
		    code = pr_Read(ng, (char *)&c, sizeof(c));
1218
		    if (code)
1219
			return code;
1220
1221
		    if ((id == ntohl(c.id)) && (c.flags & htonl(PRCONT))) {
1222
			for (i = 0; i < COSIZE; i++) {
1223
			    afs_int32 uid = ntohl(c.entries[i]);
1224
			    if (uid == 0)
1225
				break;
1226
			    if (uid == PRBADID)
1227
				continue;
1228
			    fprintf(rc, "au %d %d\n", uid, id);
1229
			    count++;
1230
			}
1231
		    } else {
1232
			fprintf(stderr, "Skipping continuation block at %d\n",
1233
				ng);
1234
			break;
1235
		    }
1236
		    ng = ntohl(c.next);
1237
		}
1238
#undef g
1239
#endif /* SUPERGROUPS */
1240
		na = ntohl(e.next);
1200
		na = ntohl(e.next);
1241
		while (na) {
1201
		while (na) {
1242
		    struct prentry c;
1202
		    struct prentry c;
(-)a/src/rxdebug/rxdebug.c (-1 / +1 lines)
Lines 449-455 MainCommand(struct cmd_syndesc *as, void *arock) Link Here
449
			    printf("\n  Received %d bytes in %d packets\n",
449
			    printf("\n  Received %d bytes in %d packets\n",
450
				   tconn.secStats.bytesReceived,
450
				   tconn.secStats.bytesReceived,
451
				   tconn.secStats.packetsReceived);
451
				   tconn.secStats.packetsReceived);
452
			    printf("  Sent %d bytes in %d packets\n",
452
			    printf("  Sent %u bytes in %u packets\n",
453
				   tconn.secStats.bytesSent,
453
				   tconn.secStats.bytesSent,
454
				   tconn.secStats.packetsSent);
454
				   tconn.secStats.packetsSent);
455
			} else
455
			} else
(-)a/src/shlibafsauthent/Makefile.in (-3 / +17 lines)
Lines 104-112 ${DEST}/lib/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT} Link Here
104
	-ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}
104
	-ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}
105
	-ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
105
	-ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
106
106
107
all: ${TOP_LIBDIR}/${LIBAFSAUTHENT}
107
${DEST}/lib/libafsauthent_pic.a: libafsauthent_pic.a
108
	${INSTALL} libafsauthent_pic.a ${DEST}/lib/libafsauthent_pic.a
108
109
109
install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT}
110
all: ${TOP_LIBDIR}/${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent_pic.a
111
112
install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent_pic.a
110
113
111
${LIBAFSAUTHENT}: ${LIBOBJS}
114
${LIBAFSAUTHENT}: ${LIBOBJS}
112
	case ${SYS_NAME} in \
115
	case ${SYS_NAME} in \
Lines 120-125 ${LIBAFSAUTHENT}: ${LIBOBJS} Link Here
120
		${SHLIB_LINKER} -o ${LIBAFSAUTHENT} ${LIBOBJS} -L${TOP_LIBDIR} -lafsrpc ${MT_LIBS};; \
123
		${SHLIB_LINKER} -o ${LIBAFSAUTHENT} ${LIBOBJS} -L${TOP_LIBDIR} -lafsrpc ${MT_LIBS};; \
121
	esac
124
	esac
122
125
126
libafsauthent_pic.a: ${LIBOBJS}
127
	$(RM) -f $@
128
	$(AR) crv $@ ${LIBOBJS}
129
	$(RANLIB) $@
130
123
audit.o: ${AUDIT}/audit.c
131
audit.o: ${AUDIT}/audit.c
124
	${CCRULE}
132
	${CCRULE}
125
133
Lines 282-290 ${DESTDIR}${libdir}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT} Link Here
282
	-ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}
290
	-ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}
283
	-ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
291
	-ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
284
292
293
${DESTDIR}${libdir}/libafsauthent_pic.a: libafsauthent_pic.a
294
	${INSTALL} libafsauthent_pic.a ${DESTDIR}${libdir}/libafsauthent_pic.a
295
285
${TOP_LIBDIR}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT}
296
${TOP_LIBDIR}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT}
286
	${INSTALL} ${LIBAFSAUTHENT} ${TOP_LIBDIR}/${LIBAFSAUTHENT}
297
	${INSTALL} ${LIBAFSAUTHENT} ${TOP_LIBDIR}/${LIBAFSAUTHENT}
287
	-ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}
298
	-ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}
288
	-ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
299
	-ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
289
300
290
dest: ${DEST}/lib/${LIBAFSAUTHENT}
301
${TOP_LIBDIR}/libafsauthent_pic.a: libafsauthent_pic.a
302
	${INSTALL} libafsauthent_pic.a ${TOP_LIBDIR}/libafsauthent_pic.a
303
304
dest: ${DEST}/lib/${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent_pic.a
(-)a/src/shlibafsrpc/Makefile.in (-3 / +16 lines)
Lines 134-148 LIBOBJS = \ Link Here
134
134
135
LIBAFSRPC = libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}.${LIBAFSRPCMINOR}
135
LIBAFSRPC = libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}.${LIBAFSRPCMINOR}
136
136
137
all: ${TOP_LIBDIR}/${LIBAFSRPC}
137
all: ${TOP_LIBDIR}/${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc_pic.a
138
138
139
install: ${DESTDIR}${libdir}/${LIBAFSRPC}
139
install: ${DESTDIR}${libdir}/${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc_pic.a
140
140
141
${DEST}/lib/${LIBAFSRPC}: ${LIBAFSRPC}
141
${DEST}/lib/${LIBAFSRPC}: ${LIBAFSRPC}
142
	${INSTALL} ${LIBAFSRPC} ${DEST}/lib/${LIBAFSRPC}
142
	${INSTALL} ${LIBAFSRPC} ${DEST}/lib/${LIBAFSRPC}
143
	-ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}
143
	-ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}
144
	-ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
144
	-ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
145
145
146
${DEST}/lib/libafsrpc_pic.a: libafsrpc_pic.a
147
	${INSTALL} libafsrpc_pic.a ${DEST}/lib/libafsrpc_pic.a
148
146
${LIBAFSRPC}: ${LIBOBJS}
149
${LIBAFSRPC}: ${LIBOBJS}
147
	case ${SYS_NAME} in \
150
	case ${SYS_NAME} in \
148
	rs_aix4* | rs_aix5*) \
151
	rs_aix4* | rs_aix5*) \
Lines 157-162 ${LIBAFSRPC}: ${LIBOBJS} Link Here
157
		${SHLIB_LINKER} -o ${LIBAFSRPC} ${LIBOBJS} ${MT_LIBS};; \
160
		${SHLIB_LINKER} -o ${LIBAFSRPC} ${LIBOBJS} ${MT_LIBS};; \
158
	esac
161
	esac
159
162
163
libafsrpc_pic.a: ${LIBOBJS}
164
	$(RM) -f $@
165
	$(AR) crv $@ ${LIBOBJS}
166
	$(RANLIB) $@
167
160
rx_event.o: ${RX}/rx_event.c
168
rx_event.o: ${RX}/rx_event.c
161
	${CCRULE}
169
	${CCRULE}
162
170
Lines 418-427 ${DESTDIR}${libdir}/${LIBAFSRPC}: ${LIBAFSRPC} Link Here
418
	-ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}
426
	-ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}
419
	-ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
427
	-ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
420
428
429
${DESTDIR}${libdir}/libafsrpc_pic.a: libafsrpc_pic.a
430
	${INSTALL} libafsrpc_pic.a ${DESTDIR}${libdir}/libafsrpc_pic.a
431
421
${TOP_LIBDIR}/${LIBAFSRPC}: ${LIBAFSRPC}
432
${TOP_LIBDIR}/${LIBAFSRPC}: ${LIBAFSRPC}
422
	${INSTALL} ${LIBAFSRPC} ${TOP_LIBDIR}/${LIBAFSRPC}
433
	${INSTALL} ${LIBAFSRPC} ${TOP_LIBDIR}/${LIBAFSRPC}
423
	-ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}
434
	-ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}
424
	-ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
435
	-ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
425
436
426
dest: ${DEST}/lib/${LIBAFSRPC}
437
${TOP_LIBDIR}/libafsrpc_pic.a: libafsrpc_pic.a
438
	${INSTALL} libafsrpc_pic.a ${TOP_LIBDIR}/libafsrpc_pic.a
427
439
440
dest: ${DEST}/lib/${LIBAFSRPC} ${DEST}/lib/libafsrpc_pic.a
(-)a/src/tests/dumptool.c (-3 / +7 lines)
Lines 314-319 main(int argc, char *argv[]) Link Here
314
    struct winsize win;
314
    struct winsize win;
315
    FILE *f;
315
    FILE *f;
316
    int fd;
316
    int fd;
317
    time_t tmv;
317
318
318
#ifdef RESIDENCY
319
#ifdef RESIDENCY
319
    for (i = 0; i < RS_MAXRESIDENCIES; i++) {
320
    for (i = 0; i < RS_MAXRESIDENCIES; i++) {
Lines 486-494 main(int argc, char *argv[]) Link Here
486
	    printf(" needsSalvaged");
487
	    printf(" needsSalvaged");
487
	printf("\n");
488
	printf("\n");
488
	printf("\tuniquifier = %lu\n", vol.uniquifier);
489
	printf("\tuniquifier = %lu\n", vol.uniquifier);
489
	printf("\tCreation date = %s", ctime((time_t *) & vol.creationDate));
490
	tmv = vol.creationDate;
490
	printf("\tLast access date = %s", ctime((time_t *) & vol.accessDate));
491
	printf("\tCreation date = %s", ctime(&tmv));
491
	printf("\tLast update date = %s", ctime((time_t *) & vol.updateDate));
492
	tmv = vol.accessDate;
493
	printf("\tLast access date = %s", ctime(&tmv));
494
	tmv = vol.updateDate;
495
	printf("\tLast update date = %s", ctime(&tmv));
492
	printf("\tVolume owner = %lu\n", vol.owner);
496
	printf("\tVolume owner = %lu\n", vol.owner);
493
    }
497
    }
494
498
(-)a/src/ubik/recovery.c (-1 / +3 lines)
Lines 207-212 ReplayLog(register struct ubik_dbase *adbase) Link Here
207
			     sizeof(afs_int32));
207
			     sizeof(afs_int32));
208
	if (code != sizeof(afs_int32))
208
	if (code != sizeof(afs_int32))
209
	    break;
209
	    break;
210
	opcode = ntohl(opcode);
210
	if (opcode == LOGNEW) {
211
	if (opcode == LOGNEW) {
211
	    /* handle begin trans */
212
	    /* handle begin trans */
212
	    tpos += sizeof(afs_int32);
213
	    tpos += sizeof(afs_int32);
Lines 231-237 ReplayLog(register struct ubik_dbase *adbase) Link Here
231
	    if (code != 3 * sizeof(afs_int32))
232
	    if (code != 3 * sizeof(afs_int32))
232
		break;
233
		break;
233
	    /* otherwise, skip over the data bytes, too */
234
	    /* otherwise, skip over the data bytes, too */
234
	    tpos += buffer[2] + 3 * sizeof(afs_int32);
235
	    tpos += ntohl(buffer[2]) + 3 * sizeof(afs_int32);
235
	} else {
236
	} else {
236
	    ubik_dprint("corrupt log opcode (%d) at position %d\n", opcode,
237
	    ubik_dprint("corrupt log opcode (%d) at position %d\n", opcode,
237
			tpos);
238
			tpos);
Lines 250-255 ReplayLog(register struct ubik_dbase *adbase) Link Here
250
				 sizeof(afs_int32));
251
				 sizeof(afs_int32));
251
	    if (code != sizeof(afs_int32))
252
	    if (code != sizeof(afs_int32))
252
		break;
253
		break;
254
	    opcode = ntohl(opcode);
253
	    if (opcode == LOGNEW) {
255
	    if (opcode == LOGNEW) {
254
		/* handle begin trans */
256
		/* handle begin trans */
255
		tpos += sizeof(afs_int32);
257
		tpos += sizeof(afs_int32);
(-)a/src/venus/fstrace.c (-3 / +7 lines)
Lines 278-283 DisplayRecord(outFilep, alp, rsize) Link Here
278
    int status;
278
    int status;
279
    int printed;		/* did we print the string yet? */
279
    int printed;		/* did we print the string yet? */
280
    afs_int32 *tlp;
280
    afs_int32 *tlp;
281
    time_t tmv;
281
282
282
    /* decode parameters */
283
    /* decode parameters */
283
    temp = alp[0];		/* type encoded in low-order 24 bits, t0 high */
284
    temp = alp[0];		/* type encoded in low-order 24 bits, t0 high */
Lines 347-353 DisplayRecord(outFilep, alp, rsize) Link Here
347
#endif /* AFS_SGI64_ENV */
348
#endif /* AFS_SGI64_ENV */
348
	    break;
349
	    break;
349
	case ICL_TYPE_UNIXDATE:
350
	case ICL_TYPE_UNIXDATE:
350
	    printfParms[pfpix++] = (long)ctime((time_t *) & alp[pix]);
351
	    tmv = alp[pix];
352
	    printfParms[pfpix++] = (long)ctime(&tmv);
351
	    break;
353
	    break;
352
	default:
354
	default:
353
	    printf("DisplayRecord: Bad type %d in decode switch.\n", type);
355
	    printf("DisplayRecord: Bad type %d in decode switch.\n", type);
Lines 443-450 DisplayRecord(outFilep, alp, rsize) Link Here
443
    }
445
    }
444
    if (!printed) {
446
    if (!printed) {
445
	if (alp[1] == ICL_INFO_TIMESTAMP) {
447
	if (alp[1] == ICL_INFO_TIMESTAMP) {
448
	    tmv = alp[4];
446
	    fprintf(outFilep, "time %d.%06d, pid %u: %s\n", alp[3] / 1000000,
449
	    fprintf(outFilep, "time %d.%06d, pid %u: %s\n", alp[3] / 1000000,
447
		    alp[3] % 1000000, alp[2], ctime((time_t *) & alp[4]));
450
		    alp[3] % 1000000, alp[2], ctime(&tmv));
448
	} else {
451
	} else {
449
	    fprintf(outFilep, "raw op %d, time %d.%06d, pid %u\n", alp[1],
452
	    fprintf(outFilep, "raw op %d, time %d.%06d, pid %u\n", alp[1],
450
		    alp[3] / 1000000, alp[3] % 1000000, alp[2]);
453
		    alp[3] / 1000000, alp[3] % 1000000, alp[2]);
Lines 493-500 DisplayRecord(outFilep, alp, rsize) Link Here
493
		    fprintf(outFilep, "p%d:%s ", i, (char *)&alp[pix]);
496
		    fprintf(outFilep, "p%d:%s ", i, (char *)&alp[pix]);
494
		    break;
497
		    break;
495
		case ICL_TYPE_UNIXDATE:
498
		case ICL_TYPE_UNIXDATE:
499
		    tmv = alp[pix];
496
		    fprintf(outFilep, "p%d:%s ", i,
500
		    fprintf(outFilep, "p%d:%s ", i,
497
			    ctime((time_t *) & alp[pix]));
501
			    ctime(&tmv));
498
		    break;
502
		    break;
499
		default:
503
		default:
500
		    printf
504
		    printf
(-)a/src/viced/afsfileprocs.c (-1 / +2 lines)
Lines 7469-7475 StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, Link Here
7469
	FDH_SYNC(fdP);
7469
	FDH_SYNC(fdP);
7470
    }
7470
    }
7471
    if (errorCode) {
7471
    if (errorCode) {
7472
	afs_fsize_t nfSize = (afs_fsize_t) FDH_SIZE(fdP);
7472
	afs_sfsize_t nfSize = FDH_SIZE(fdP);
7473
	assert(nfSize >= 0);
7473
	/* something went wrong: adjust size and return */
7474
	/* something went wrong: adjust size and return */
7474
	VN_SET_LEN(targetptr, nfSize);	/* set new file size. */
7475
	VN_SET_LEN(targetptr, nfSize);	/* set new file size. */
7475
	/* changed_newTime is tested in StoreData to detemine if we
7476
	/* changed_newTime is tested in StoreData to detemine if we
(-)a/src/viced/callback.c (-71 / +96 lines)
Lines 292-299 static int MultiBreakVolumeCallBack(struct host *host, int isheld, Link Here
292
				    struct VCBParams *parms);
292
				    struct VCBParams *parms);
293
static int MultiBreakVolumeLaterCallBack(struct host *host, int isheld,
293
static int MultiBreakVolumeLaterCallBack(struct host *host, int isheld,
294
					 struct VCBParams *parms);
294
					 struct VCBParams *parms);
295
static int lih_r(register struct host *host, register int held,
296
		 register struct host *hostp);
297
static int GetSomeSpace_r(struct host *hostp, int locked);
295
static int GetSomeSpace_r(struct host *hostp, int locked);
298
static int ClearHostCallbacks_r(struct host *hp, int locked);
296
static int ClearHostCallbacks_r(struct host *hp, int locked);
299
297
Lines 1577-1644 CleanupTimedOutCallBacks_r(void) Link Here
1577
    return (ntimedout > 0);
1575
    return (ntimedout > 0);
1578
}
1576
}
1579
1577
1580
static struct host *lih_host;
1578
/**
1581
static int lih_host_held;
1579
 * parameters to pass to lih*_r from h_Enumerate_r when trying to find a host
1580
 * from which to clear callbacks.
1581
 */
1582
struct lih_params {
1583
    /**
1584
     * Points to the least interesting host found; try to clear callbacks on
1585
     * this host after h_Enumerate_r(lih*_r)'ing.
1586
     */
1587
    struct host *lih;
1582
1588
1583
static int
1589
    /**
1584
lih_r(register struct host *host, register int held,
1590
     * The last host we got from lih*_r, but we couldn't clear its callbacks
1585
      register struct host *hostp)
1591
     * for some reason. Choose the next-best host after this one (with the
1586
{
1592
     * current lih*_r, this means to only select hosts that have an ActiveCall
1587
    if (host->cblist
1593
     * newer than lastlih).
1588
	&& ((hostp && host != hostp) || (!held && !h_OtherHolds_r(host)))
1594
     */
1589
	&& (!lih_host || host->ActiveCall < lih_host->ActiveCall)) {
1595
    struct host *lastlih;
1590
	if (lih_host != NULL && lih_host_held) {
1596
1591
	    h_Release_r(lih_host);
1597
    /**
1592
	}
1598
     * 1 if lih was held, 0 if it was not and should be released.
1593
	lih_host = host;
1599
     */
1594
	lih_host_held = !held;
1600
    int lih_held;
1595
	held = 1;
1601
};
1596
    }
1597
    return held;
1598
}
1599
1602
1600
/* This version does not allow 'host' to be selected unless its ActiveCall 
1603
/* This version does not allow 'host' to be selected unless its ActiveCall 
1601
 * is newer than 'hostp' which is the host with the oldest ActiveCall from
1604
 * is newer than 'params->lastlih' which is the host with the oldest
1602
 * the last pass (if it is provided).  We filter out any hosts that are
1605
 * ActiveCall from the last pass (if it is provided).  We filter out any hosts
1603
 * are held by other threads.
1606
 * that are are held by other threads.
1607
 *
1608
 * There is a small problem here, but it may not be easily fixable. Say we
1609
 * select some host A, and give it back to GetSomeSpace_r. GSS_r for some
1610
 * reason cannot clear the callbacks on A, and so calls us again with
1611
 * lastlih = A. Suppose there is another host B that has the same ActiveCall
1612
 * time as A. We will now skip over host B, since
1613
 * 'hostB->ActiveCall > hostA->ActiveCall' is not true. This could result in
1614
 * us prematurely going to the GSS_r 2nd or 3rd pass, and making us a little
1615
 * inefficient. This should be pretty rare, though, except perhaps in cases
1616
 * with very small numbers of hosts.
1617
 *
1618
 * Also filter out any hosts with HOSTDELETED set. h_Enumerate_r should in
1619
 * theory not give these to us anyway, but be paranoid.
1604
 */
1620
 */
1605
static int
1621
static int
1606
lih0_r(register struct host *host, register int held,
1622
lih0_r(struct host *host, int held, void *rock)
1607
      register struct host *hostp)
1608
{
1623
{
1624
    struct lih_params *params = (struct lih_params *)rock;
1625
1609
    if (host->cblist
1626
    if (host->cblist
1610
	&& (hostp && host != hostp) 
1627
	&& (!(host->hostFlags & HOSTDELETED))
1611
	&& (!held && !h_OtherHolds_r(host))
1628
	&& (!held && !h_OtherHolds_r(host))
1612
	&& (!lih_host || host->ActiveCall < lih_host->ActiveCall) 
1629
	&& (!params->lih || host->ActiveCall < params->lih->ActiveCall)
1613
	&& (!hostp || host->ActiveCall > hostp->ActiveCall)) {
1630
	&& (!params->lastlih || host->ActiveCall > params->lastlih->ActiveCall)) {
1614
	if (lih_host != NULL && lih_host_held) {
1631
1615
	    h_Release_r(lih_host);
1632
	if (params->lih && !params->lih_held) {
1633
	    h_Release_r(params->lih); /* release prev host */
1616
	}
1634
	}
1617
	lih_host = host;
1635
1618
	lih_host_held = !held;
1636
	params->lih = host;
1637
	params->lih_held = held;
1619
	held = 1;
1638
	held = 1;
1620
    }
1639
    }
1621
    return held;
1640
    return held;
1622
}
1641
}
1623
1642
1624
/* This version does not allow 'host' to be selected unless its ActiveCall 
1643
/* same as lih0_r, except we do not prevent held hosts from being selected. */
1625
 * is newer than 'hostp' which is the host with the oldest ActiveCall from
1626
 * the last pass (if it is provided).  In this second varient, we do not 
1627
 * prevent held hosts from being selected.
1628
 */
1629
static int
1644
static int
1630
lih1_r(register struct host *host, register int held,
1645
lih1_r(struct host *host, int held, void *rock)
1631
      register struct host *hostp)
1632
{
1646
{
1647
    struct lih_params *params = (struct lih_params *)rock;
1648
1633
    if (host->cblist
1649
    if (host->cblist
1634
	&& (hostp && host != hostp) 
1650
	&& (!(host->hostFlags & HOSTDELETED))
1635
	&& (!lih_host || host->ActiveCall < lih_host->ActiveCall) 
1651
	&& (!params->lih || host->ActiveCall < params->lih->ActiveCall)
1636
	&& (!hostp || host->ActiveCall > hostp->ActiveCall)) {
1652
	&& (!params->lastlih || host->ActiveCall > params->lastlih->ActiveCall)) {
1637
	if (lih_host != NULL && lih_host_held) {
1653
1638
	    h_Release_r(lih_host);
1654
	if (params->lih && !params->lih_held) {
1655
	    h_Release_r(params->lih); /* release prev host */
1639
	}
1656
	}
1640
	lih_host = host;
1657
1641
	lih_host_held = !held;
1658
	params->lih = host;
1659
	params->lih_held = held;
1642
	held = 1;
1660
	held = 1;
1643
    }
1661
    }
1644
    return held;
1662
    return held;
Lines 1659-1666 extern struct host *hostList; Link Here
1659
static int
1677
static int
1660
GetSomeSpace_r(struct host *hostp, int locked)
1678
GetSomeSpace_r(struct host *hostp, int locked)
1661
{
1679
{
1662
    register struct host *hp, *hp1, *hp2;
1680
    struct host *hp;
1681
    struct lih_params params;
1663
    int i = 0;
1682
    int i = 0;
1683
    int lastlih_held = 1;
1664
1684
1665
    cbstuff.GotSomeSpaces++;
1685
    cbstuff.GotSomeSpaces++;
1666
    ViceLog(5,
1686
    ViceLog(5,
Lines 1671-1708 GetSomeSpace_r(struct host *hostp, int locked) Link Here
1671
    }
1691
    }
1672
1692
1673
    i = 0;
1693
    i = 0;
1674
    hp1 = NULL;
1694
    params.lastlih = NULL;
1675
    hp2 = hostList;
1695
1676
    do {
1696
    do {
1677
	lih_host = 0;
1697
	params.lih = NULL;
1678
	h_Enumerate_r(i == 0 ? lih0_r : lih1_r, hp2, (char *)hp1);
1698
1679
	hp = lih_host;
1699
	h_Enumerate_r(i == 0 ? lih0_r : lih1_r, hostList, &params);
1700
1701
	hp = params.lih;
1702
	if (params.lastlih && !lastlih_held) {
1703
	    h_Release_r(params.lastlih);
1704
	    lastlih_held = 1;
1705
	}
1706
	params.lastlih = NULL;
1707
1680
	if (hp) {
1708
	if (hp) {
1681
	    /* set in lih_r! private copy before giving up H_LOCK */
1709
	    /* note that 'hp' was held by lih*_r; we will need to release it */
1682
	    int lih_host_held2=lih_host_held;   
1683
	    cbstuff.GSS4++;
1710
	    cbstuff.GSS4++;
1684
	    if ((hp != hostp) && !ClearHostCallbacks_r(hp, 0 /* not locked or held */ )) {
1711
	    if ((hp != hostp) && !ClearHostCallbacks_r(hp, 0 /* not locked or held */ )) {
1685
		if (lih_host_held2)
1712
		if (!params.lih_held) {
1686
		    h_Release_r(hp);
1713
		    h_Release_r(hp);
1714
		}
1687
		return 0;
1715
		return 0;
1688
	    }
1716
	    }
1689
	    if (lih_host_held2) {
1717
1690
		h_Release_r(hp);
1718
	    params.lastlih = hp;
1691
		hp = NULL;
1719
	    lastlih_held = params.lih_held;
1692
	    }
1720
	    /* params.lastlih will be released on the next iteration, after
1693
	    hp1 = hp;
1721
	     * h_Enumerate_r */
1694
	    hp2 = hostList;
1722
1695
	} else {
1723
	} else {
1696
	    /*
1724
	    /*
1697
	     * Next time try getting callbacks from any host even if
1725
	     * Next time try getting callbacks from any host even if
1698
	     * it's deleted (that's actually great since we can freely
1726
	     * it's held, since the only other option is starvation for
1699
	     * remove its callbacks) or it's held since the only other
1727
	     * the file server (i.e. until the callback timeout arrives).
1700
	     * option is starvation for the file server (i.e. until the
1701
	     * callback timeout arrives).
1702
	     */
1728
	     */
1703
	    i++;
1729
	    i++;
1704
	    hp1 = NULL;
1730
	    params.lastlih = NULL;
1705
	    hp2 = hostList;
1706
	    cbstuff.GSS1++;
1731
	    cbstuff.GSS1++;
1707
	    ViceLog(5,
1732
	    ViceLog(5,
1708
		    ("GSS: Try harder for longest inactive host cnt= %d\n",
1733
		    ("GSS: Try harder for longest inactive host cnt= %d\n",
Lines 2159-2168 MultiBreakCallBackAlternateAddress_r(struct host *host, Link Here
2159
	    if (host->callback_rxcon)
2184
	    if (host->callback_rxcon)
2160
		rx_DestroyConnection(host->callback_rxcon);
2185
		rx_DestroyConnection(host->callback_rxcon);
2161
	    host->callback_rxcon = conns[multi_i];
2186
	    host->callback_rxcon = conns[multi_i];
2162
            hashDelete_r(host->host, host->port, host);
2187
            h_DeleteHostFromAddrHashTable_r(host->host, host->port, host);
2163
	    host->host = interfaces[multi_i].addr;
2188
	    host->host = interfaces[multi_i].addr;
2164
	    host->port = interfaces[multi_i].port;
2189
	    host->port = interfaces[multi_i].port;
2165
            hashInsert_r(host->host, host->port, host);
2190
            h_AddHostToAddrHashTable_r(host->host, host->port, host);
2166
	    connSuccess = conns[multi_i];
2191
	    connSuccess = conns[multi_i];
2167
	    rx_SetConnDeadTime(host->callback_rxcon, 50);
2192
	    rx_SetConnDeadTime(host->callback_rxcon, 50);
2168
	    rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
2193
	    rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
Lines 2252-2262 MultiProbeAlternateAddress_r(struct host *host) Link Here
2252
	    H_LOCK;
2277
	    H_LOCK;
2253
	    if (host->callback_rxcon)
2278
	    if (host->callback_rxcon)
2254
		rx_DestroyConnection(host->callback_rxcon);
2279
		rx_DestroyConnection(host->callback_rxcon);
2255
            hashDelete_r(host->host, host->port, host);
2280
            h_DeleteHostFromAddrHashTable_r(host->host, host->port, host);
2256
	    host->callback_rxcon = conns[multi_i];
2281
	    host->callback_rxcon = conns[multi_i];
2257
	    host->host = interfaces[multi_i].addr;
2282
	    host->host = interfaces[multi_i].addr;
2258
	    host->port = interfaces[multi_i].port;
2283
	    host->port = interfaces[multi_i].port;
2259
            hashInsert_r(host->host, host->port, host);
2284
            h_AddHostToAddrHashTable_r(host->host, host->port, host);
2260
	    connSuccess = conns[multi_i];
2285
	    connSuccess = conns[multi_i];
2261
	    rx_SetConnDeadTime(host->callback_rxcon, 50);
2286
	    rx_SetConnDeadTime(host->callback_rxcon, 50);
2262
	    rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
2287
	    rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
(-)a/src/viced/host.c (-216 / +313 lines)
Lines 10-16 Link Here
10
#include <afsconfig.h>
10
#include <afsconfig.h>
11
#include <afs/param.h>
11
#include <afs/param.h>
12
12
13
14
#include <stdio.h>
13
#include <stdio.h>
15
#include <errno.h>
14
#include <errno.h>
16
#include <string.h>
15
#include <string.h>
Lines 503-517 h_Release_r(register struct host *host) Link Here
503
	if (!h_OtherHolds_r(host)) {
502
	if (!h_OtherHolds_r(host)) {
504
	    /* must avoid masking this until after h_OtherHolds_r runs
503
	    /* must avoid masking this until after h_OtherHolds_r runs
505
	     * but it should be run before h_TossStuff_r */
504
	     * but it should be run before h_TossStuff_r */
506
	    (host)->holds[h_holdSlot()] &= ~h_holdbit();
505
	    h_Decrement_r(host);
507
	    if ((host->hostFlags & HOSTDELETED)
506
	    if ((host->hostFlags & HOSTDELETED)
508
		|| (host->hostFlags & CLIENTDELETED)) {
507
		|| (host->hostFlags & CLIENTDELETED)) {
509
		h_TossStuff_r(host);
508
		h_TossStuff_r(host);
510
	    }
509
	    }
511
	} else
510
	} else {
512
	    (host)->holds[h_holdSlot()] &= ~h_holdbit();
511
	    h_Decrement_r(host);
513
    } else
512
	}
514
	(host)->holds[h_holdSlot()] &= ~h_holdbit();
513
    } else {
514
	h_Decrement_r(host);
515
    }
515
516
516
    return 0;
517
    return 0;
517
}
518
}
Lines 766-772 h_Alloc_r(register struct rx_connection *r_con) Link Here
766
    host->host = rxr_HostOf(r_con);
767
    host->host = rxr_HostOf(r_con);
767
    host->port = rxr_PortOf(r_con);
768
    host->port = rxr_PortOf(r_con);
768
769
769
    hashInsert_r(host->host, host->port, host);
770
    h_AddHostToAddrHashTable_r(host->host, host->port, host);
770
771
771
    if (consolePort == 0) {	/* find the portal number for console */
772
    if (consolePort == 0) {	/* find the portal number for console */
772
#if	defined(AFS_OSF_ENV)
773
#if	defined(AFS_OSF_ENV)
Lines 887-898 h_LookupUuid_r(afsUUID * uuidp) Link Here
887
	assert(host);
888
	assert(host);
888
	if (!(host->hostFlags & HOSTDELETED) && host->interface
889
	if (!(host->hostFlags & HOSTDELETED) && host->interface
889
	    && afs_uuid_equal(&host->interface->uuid, uuidp)) {
890
	    && afs_uuid_equal(&host->interface->uuid, uuidp)) {
890
	    break;
891
	    return host;
891
	}
892
	}
892
	host = NULL;
893
    }
893
    }
894
    return host;
894
    return NULL;
895
896
}				/*h_Lookup */
895
}				/*h_Lookup */
897
896
898
897
Lines 913-935 h_TossStuff_r(register struct host *host) Link Here
913
{
912
{
914
    register struct client **cp, *client;
913
    register struct client **cp, *client;
915
    int i;
914
    int i;
915
    int code;
916
916
917
    /* if somebody still has this host held */
917
    /* make sure host doesn't go away over h_NBLock_r */
918
    for (i = 0; (i < h_maxSlots) && (!(host)->holds[i]); i++);
918
    h_Hold_r(host);
919
    if (i != h_maxSlots)
919
920
	return;
920
    code = h_NBLock_r(host);
921
922
    /* don't use h_Release_r, since that may call h_TossStuff_r again */
923
    h_Decrement_r(host);
921
924
922
    /* if somebody still has this host locked */
925
    /* if somebody still has this host locked */
923
    if (h_NBLock_r(host) != 0) {
926
    if (code != 0) {
924
	char hoststr[16];
927
	char hoststr[16];
925
	ViceLog(0,
928
	ViceLog(0,
926
		("Warning:  h_TossStuff_r failed; Host %s:%d was locked.\n",
929
		("Warning:  h_TossStuff_r failed; Host 0x%lx (%s:%d) was locked.\n",
927
		 afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
930
		 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
928
	return;
931
	return;
929
    } else {
932
    } else {
930
	h_Unlock_r(host);
933
	h_Unlock_r(host);
931
    }
934
    }
932
935
936
    /* if somebody still has this host held */
937
    /* we must check this _after_ h_NBLock_r, since h_NBLock_r can drop and
938
     * reacquire H_LOCK */
939
    for (i = 0; (i < h_maxSlots) && (!(host)->holds[i]); i++);
940
    if (i != h_maxSlots) {
941
	char hoststr[16];
942
	ViceLog(0,
943
		("Warning:  h_TossStuff_r failed; Host 0x%lx (%s:%d) was held.\n",
944
		 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
945
	return;
946
    }
947
933
    /* ASSUMPTION: rxi_FreeConnection() does not yield */
948
    /* ASSUMPTION: rxi_FreeConnection() does not yield */
934
    for (cp = &host->FirstClient; (client = *cp);) {
949
    for (cp = &host->FirstClient; (client = *cp);) {
935
	if ((host->hostFlags & HOSTDELETED) || client->deleted) {
950
	if ((host->hostFlags & HOSTDELETED) || client->deleted) {
Lines 938-945 h_TossStuff_r(register struct host *host) Link Here
938
	    if (code < 0) {
953
	    if (code < 0) {
939
		char hoststr[16];
954
		char hoststr[16];
940
		ViceLog(0,
955
		ViceLog(0,
941
			("Warning: h_TossStuff_r failed: Host %s:%d client %x was locked.\n",
956
			("Warning: h_TossStuff_r failed: Host 0x%lx (%s:%d) client %x was locked.\n",
942
			 afs_inet_ntoa_r(host->host, hoststr),
957
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
943
			 ntohs(host->port), client));
958
			 ntohs(host->port), client));
944
		return;
959
		return;
945
	    }
960
	    }
Lines 947-954 h_TossStuff_r(register struct host *host) Link Here
947
	    if (client->refCount) {
962
	    if (client->refCount) {
948
		char hoststr[16];
963
		char hoststr[16];
949
		ViceLog(0,
964
		ViceLog(0,
950
			("Warning: h_TossStuff_r failed: Host %s:%d client %x refcount %d.\n",
965
			("Warning: h_TossStuff_r failed: Host 0x%lx (%s:%d) client %x refcount %d.\n",
951
			 afs_inet_ntoa_r(host->host, hoststr),
966
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
952
			 ntohs(host->port), client, client->refCount));
967
			 ntohs(host->port), client, client->refCount));
953
		/* This is the same thing we do if the host is locked */
968
		/* This is the same thing we do if the host is locked */
954
		ReleaseWriteLock(&client->lock);
969
		ReleaseWriteLock(&client->lock);
Lines 970-978 h_TossStuff_r(register struct host *host) Link Here
970
    host->hostFlags &= ~CLIENTDELETED;
985
    host->hostFlags &= ~CLIENTDELETED;
971
986
972
    if (host->hostFlags & HOSTDELETED) {
987
    if (host->hostFlags & HOSTDELETED) {
973
        register struct h_AddrHashChain **ahp, *ath;
974
	register struct rx_connection *rxconn;
988
	register struct rx_connection *rxconn;
975
	afsUUID *uuidp;
976
	struct AddrPort hostAddrPort;
989
	struct AddrPort hostAddrPort;
977
	int i;
990
	int i;
978
991
Lines 991-1034 h_TossStuff_r(register struct host *host) Link Here
991
1004
992
	/* if alternate addresses do not exist */
1005
	/* if alternate addresses do not exist */
993
	if (!(host->interface)) {
1006
	if (!(host->interface)) {
994
	    for (ahp = &hostAddrHashTable[h_HashIndex(host->host)]; (ath = *ahp);
1007
	    h_DeleteHostFromAddrHashTable_r(host->host, host->port, host);
995
		 ahp = &ath->next) {
996
		assert(ath->hostPtr);
997
		if (ath->hostPtr == host) {
998
		    *ahp = ath->next;
999
		    free(ath);
1000
		    break;
1001
		}
1002
	    }
1003
	} else {
1008
	} else {
1004
            register struct h_UuidHashChain **uhp, *uth;
1009
	    h_DeleteHostFromUuidHashTable_r(host);
1005
	    /* delete the hash entry for the UUID */
1010
	    h_DeleteHostFromAddrHashTable_r(host->host, host->port, host);
1006
	    uuidp = &host->interface->uuid;
1011
	    /* delete the hash entry for each valid alternate addresses */
1007
	    for (uhp = &hostUuidHashTable[h_UuidHashIndex(uuidp)]; (uth = *uhp);
1008
		 uhp = &uth->next) {
1009
		assert(uth->hostPtr);
1010
		if (uth->hostPtr == host) {
1011
		    *uhp = uth->next;
1012
		    free(uth);
1013
		    break;
1014
		}
1015
	    }
1016
	    /* delete the hash entry for each alternate addresses */
1017
	    for (i = 0; i < host->interface->numberOfInterfaces; i++) {
1012
	    for (i = 0; i < host->interface->numberOfInterfaces; i++) {
1018
		hostAddrPort = host->interface->interface[i];
1013
		hostAddrPort = host->interface->interface[i];
1019
1014
		/*
1020
                if (!hostAddrPort.valid)
1015
		 * if the interface addr/port is the primary, we already
1021
                    continue;
1016
		 * removed it.  If the addr/port is not valid, its not
1022
1017
		 * in the hash table.
1023
		for (ahp = &hostAddrHashTable[h_HashIndex(hostAddrPort.addr)]; (ath = *ahp);
1018
		 */
1024
		     ahp = &ath->next) {
1019
		if (hostAddrPort.valid &&
1025
		    assert(ath->hostPtr);
1020
		    (host->host != hostAddrPort.addr ||
1026
		    if (ath->hostPtr == host) {
1021
		     host->port != hostAddrPort.port))
1027
			*ahp = ath->next;
1022
		    h_DeleteHostFromAddrHashTable_r(hostAddrPort.addr, hostAddrPort.port, host);
1028
			free(ath);
1029
			break;
1030
		    }
1031
		}
1032
	    }
1023
	    }
1033
	    free(host->interface);
1024
	    free(host->interface);
1034
	    host->interface = NULL;
1025
	    host->interface = NULL;
Lines 1184-1248 h_Enumerate_r(int (*proc) (), struct host *enumstart, char *param) Link Here
1184
1175
1185
/* inserts a new HashChain structure corresponding to this UUID */
1176
/* inserts a new HashChain structure corresponding to this UUID */
1186
void
1177
void
1187
hashInsertUuid_r(struct afsUUID *uuid, struct host *host)
1178
h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host)
1188
{
1179
{
1189
    int index;
1180
    int index;
1190
    struct h_UuidHashChain *chain;
1181
    struct h_UuidHashChain *chain;
1182
    char uuid1[128], uuid2[128];
1183
    char hoststr[16];
1191
1184
1192
    /* hash into proper bucket */
1185
    /* hash into proper bucket */
1193
    index = h_UuidHashIndex(uuid);
1186
    index = h_UuidHashIndex(uuid);
1194
1187
1195
    /* don't add the same entry multiple times */
1188
    /* don't add the same entry multiple times */
1196
    for (chain = hostUuidHashTable[index]; chain; chain = chain->next) {
1189
    for (chain = hostUuidHashTable[index]; chain; chain = chain->next) {
1190
	if (!chain->hostPtr)
1191
	    continue;
1192
1197
	if (chain->hostPtr->interface && 
1193
	if (chain->hostPtr->interface && 
1198
	    afs_uuid_equal(&chain->hostPtr->interface->uuid, uuid))
1194
	    afs_uuid_equal(&chain->hostPtr->interface->uuid, uuid)) {
1195
	    if (LogLevel >= 125) {
1196
		afsUUID_to_string(&chain->hostPtr->interface->uuid, uuid1, 127);
1197
		afsUUID_to_string(uuid, uuid2, 127);
1198
		ViceLog(125, ("h_AddHostToUuidHashTable_r: host 0x%lx (uuid %s) exists as %s:%d (uuid %s)\n",
1199
                             (unsigned long) host, uuid1,
1200
                             afs_inet_ntoa_r(chain->hostPtr->host, hoststr), 
1201
                             ntohs(chain->hostPtr->port), uuid2));
1202
	    }
1199
	    return;
1203
	    return;
1204
	}
1200
    }
1205
    }
1201
1206
1202
    /* insert into beginning of list for this bucket */
1207
    /* insert into beginning of list for this bucket */
1203
    chain = (struct h_UuidHashChain *)malloc(sizeof(struct h_UuidHashChain));
1208
    chain = (struct h_UuidHashChain *)malloc(sizeof(struct h_UuidHashChain));
1204
    if (!chain) {
1209
    if (!chain) {
1205
	ViceLog(0, ("Failed malloc in hashInsertUuid_r\n"));
1210
	ViceLog(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
1206
	assert(0);
1211
	assert(0);
1207
    }
1212
    }
1208
    assert(chain);
1209
    chain->hostPtr = host;
1213
    chain->hostPtr = host;
1210
    chain->next = hostUuidHashTable[index];
1214
    chain->next = hostUuidHashTable[index];
1211
    hostUuidHashTable[index] = chain;
1215
    hostUuidHashTable[index] = chain;
1216
    if (LogLevel < 125)
1217
	return;
1218
    afsUUID_to_string(uuid, uuid2, 127);
1219
    ViceLog(125, 
1220
            ("h_AddHostToUuidHashTable_r: host 0x%lx (%s:%d) added as uuid %s\n",
1221
             (unsigned long) host, afs_inet_ntoa_r(chain->hostPtr->host, hoststr),
1222
             ntohs(chain->hostPtr->port), uuid2));
1212
}
1223
}
1213
1224
1225
/* deletes a HashChain structure corresponding to this host */
1226
int
1227
h_DeleteHostFromUuidHashTable_r(struct host *host)
1228
{
1229
    int index;
1230
    register struct h_UuidHashChain **uhp, *uth;
1231
    char uuid1[128];
1232
    char hoststr[16];
1233
 
1234
    if (!host->interface)
1235
	return 0;
1236
 
1237
    /* hash into proper bucket */
1238
    index = h_UuidHashIndex(&host->interface->uuid);
1239
     
1240
    if (LogLevel >= 125)
1241
	afsUUID_to_string(&host->interface->uuid, uuid1, 127);
1242
    for (uhp = &hostUuidHashTable[index]; (uth = *uhp); uhp = &uth->next) {
1243
	assert(uth->hostPtr);
1244
	if (uth->hostPtr == host) {
1245
	    ViceLog(125, 
1246
                    ("h_DeleteHostFromUuidHashTable_r: host 0x%lx (uuid %s %s:%d)\n",
1247
                     (unsigned long) host, uuid1, afs_inet_ntoa_r(host->host, hoststr),
1248
                     ntohs(host->port)));
1249
	    *uhp = uth->next;
1250
	    free(uth);
1251
	    return 1;
1252
	}
1253
    }
1254
    ViceLog(125, 
1255
            ("h_DeleteHostFromUuidHashTable_r: host 0x%lx (uuid %s %s:%d) not found\n",
1256
             (unsigned long) host, uuid1, afs_inet_ntoa_r(host->host, hoststr),
1257
             ntohs(host->port)));
1258
    return 0;
1259
}
1214
1260
1215
/* inserts a new HashChain structure corresponding to this address */
1261
/* inserts a new HashChain structure corresponding to this address */
1216
void
1262
void
1217
hashInsert_r(afs_uint32 addr, afs_uint16 port, struct host *host)
1263
h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host)
1218
{
1264
{
1219
    int index;
1265
    int index;
1220
    struct h_AddrHashChain *chain;
1266
    struct h_AddrHashChain *chain;
1221
    int found = 0;
1267
    int found = 0;
1222
    char hoststr[16]; 
1268
    char hoststr[16], hoststr2[16]; 
1223
  
1269
  
1224
    /* hash into proper bucket */
1270
    /* hash into proper bucket */
1225
    index = h_HashIndex(addr);
1271
    index = h_HashIndex(addr);
1226
1272
1227
    /* don't add the same entry multiple times */
1273
    /* don't add the same entry multiple times */
1228
    for (chain = hostAddrHashTable[index]; chain; chain = chain->next) {
1274
    for (chain = hostAddrHashTable[index]; chain; chain = chain->next) {
1229
	if (chain->addr == addr && chain->port == port) {
1275
	if (chain->hostPtr == host) {
1230
	    if (chain->hostPtr == host)
1276
	    if (chain->addr != addr || chain->port != port) {
1231
		found = 1;
1277
		ViceLog(0, 
1232
	    else if (!(host->hostFlags & HOSTDELETED))
1278
                       ("h_AddHostToAddrHashTable_r: host 0x%lx exists as %s:%d when adding %s:%d\n",
1233
		ViceLog(125, ("Addr %s:%d assigned to %x and %x.\n",
1279
                        (unsigned long) host, afs_inet_ntoa_r(chain->addr, hoststr),
1234
			    afs_inet_ntoa_r(addr, hoststr), ntohs(port),
1280
                        ntohs(chain->port), afs_inet_ntoa_r(addr, hoststr2), 
1235
			    host, chain));
1281
                        ntohs(port)));
1282
	    } else
1283
		ViceLog(125, 
1284
                       ("h_AddHostToAddrHashTable_r: host 0x%lx (%s:%d) already hashed\n",
1285
                        (unsigned long) host, afs_inet_ntoa_r(chain->addr, hoststr),
1286
                        ntohs(chain->port)));
1287
           
1288
	    return;
1236
	}
1289
	}
1237
    }
1290
    }
1238
1291
1239
    if (found)
1240
	return;
1241
1242
    /* insert into beginning of list for this bucket */
1292
    /* insert into beginning of list for this bucket */
1243
    chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
1293
    chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
1244
    if (!chain) {
1294
    if (!chain) {
1245
	ViceLog(0, ("Failed malloc in hashInsert_r\n"));
1295
	ViceLog(0, ("Failed malloc in h_AddHostToAddrHashTable_r\n"));
1246
	assert(0);
1296
	assert(0);
1247
    }
1297
    }
1248
    chain->hostPtr = host;
1298
    chain->hostPtr = host;
Lines 1250-1262 hashInsert_r(afs_uint32 addr, afs_uint16 port, struct host *host) Link Here
1250
    chain->addr = addr;
1300
    chain->addr = addr;
1251
    chain->port = port;
1301
    chain->port = port;
1252
    hostAddrHashTable[index] = chain;
1302
    hostAddrHashTable[index] = chain;
1303
    ViceLog(125, ("h_AddHostToAddrHashTable_r: host 0x%lx added as %s:%d\n",
1304
                  (unsigned long) host, afs_inet_ntoa_r(addr, hoststr), ntohs(port)));
1253
}
1305
}
1254
1306
1255
/*
1307
/*
1256
 * This is called with host locked and held. At this point, the
1308
 * This is called with host locked and held. 
1257
 * hostAddrHashTable should not have entries for the alternate
1309
 * It is called to either validate or add an additional interface
1258
 * interfaces. This function has to insert these entries in the
1310
 * address/port on the specified host.  
1259
 * hostAddrHashTable.
1260
 *
1311
 *
1261
 * All addresses are in network byte order.
1312
 * All addresses are in network byte order.
1262
 */
1313
 */
Lines 1279-1300 addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1279
    for (i = 0; i < number; i++) {
1330
    for (i = 0; i < number; i++) {
1280
	if (host->interface->interface[i].addr == addr &&
1331
	if (host->interface->interface[i].addr == addr &&
1281
            host->interface->interface[i].port == port) {
1332
            host->interface->interface[i].port == port) {
1282
	    ViceLog(125, ("addInterfaceAddr : host %x (%s:%d) addr %s:%d : found, valid: %d\n",
1333
	    ViceLog(125, 
1283
			  host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
1334
                   ("addInterfaceAddr : found host 0x%lx (%s:%d) adding %s:%d%s\n",
1284
			  afs_inet_ntoa_r(addr, hoststr2), ntohs(port),
1335
                    (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1285
			  host->interface->interface[i].valid));
1336
                    ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
1337
                    ntohs(port), host->interface->interface[i].valid ? "" : 
1338
                    ", validating"));
1286
1339
1287
	    if (host->interface->interface[i].valid == 0) {
1340
	    if (host->interface->interface[i].valid == 0) {
1288
		hashInsert_r(addr, port, host);
1289
		host->interface->interface[i].valid = 1;
1341
		host->interface->interface[i].valid = 1;
1342
		h_AddHostToAddrHashTable_r(addr, port, host);
1290
	    }
1343
	    }
1291
	    return 0;
1344
	    return 0;
1292
        }
1345
        }
1293
    }
1346
    }
1294
1347
1295
    ViceLog(125, ("addInterfaceAddr : host %x (%s:%d) addr %s:%d : not found, adding\n",
1348
    ViceLog(125, ("addInterfaceAddr : host 0x%lx (%s:%d) adding %s:%d\n",
1296
		  host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
1349
                 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1297
		  afs_inet_ntoa_r(addr, hoststr2), ntohs(port)));
1350
                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
1351
                 ntohs(port)));
1298
    
1352
    
1299
    interface = (struct Interface *)
1353
    interface = (struct Interface *)
1300
	malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
1354
	malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
Lines 1306-1314 addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1306
    interface->uuid = host->interface->uuid;
1360
    interface->uuid = host->interface->uuid;
1307
    for (i = 0; i < number; i++)
1361
    for (i = 0; i < number; i++)
1308
	interface->interface[i] = host->interface->interface[i];
1362
	interface->interface[i] = host->interface->interface[i];
1363
1364
    /* Add the new valid interface */
1309
    interface->interface[number].addr = addr;
1365
    interface->interface[number].addr = addr;
1310
    interface->interface[number].port = port;
1366
    interface->interface[number].port = port;
1311
    interface->interface[number].valid = 1;
1367
    interface->interface[number].valid = 1;
1368
    h_AddHostToAddrHashTable_r(addr, port, host);
1312
    free(host->interface);
1369
    free(host->interface);
1313
    host->interface = interface;
1370
    host->interface = interface;
1314
1371
Lines 1317-1326 addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1317
1374
1318
1375
1319
/*
1376
/*
1320
 * This is called with host locked and held. At this point, the
1377
 * This is called with host locked and held.
1321
 * hostAddrHashTable should not be having entries for the alternate
1322
 * interfaces. This function has to insert these entries in the
1323
 * hostAddrHashTable.
1324
 *
1378
 *
1325
 * All addresses are in network byte order.
1379
 * All addresses are in network byte order.
1326
 */
1380
 */
Lines 1329-1344 removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1329
{
1383
{
1330
    int i;
1384
    int i;
1331
    int number;
1385
    int number;
1332
    int found;
1333
    struct Interface *interface;
1386
    struct Interface *interface;
1334
    char hoststr[16], hoststr2[16];
1387
    char hoststr[16], hoststr2[16];
1335
1388
1336
    assert(host);
1389
    assert(host);
1337
    assert(host->interface);
1390
    assert(host->interface);
1338
1391
1339
    ViceLog(125, ("removeInterfaceAddr : host %x (%s:%d) addr %s:%d\n", 
1392
    ViceLog(125, ("removeInterfaceAddr : host 0x%lx (%s:%d) addr %s:%d\n",
1340
		   host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), 
1393
                 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1341
		   afs_inet_ntoa_r(addr, hoststr2), ntohs(port)));
1394
                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
1395
                 ntohs(port)));
1342
1396
1343
    /*
1397
    /*
1344
     * Make sure this address is on the list of known addresses
1398
     * Make sure this address is on the list of known addresses
Lines 1346-1371 removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1346
     */
1400
     */
1347
    interface = host->interface;
1401
    interface = host->interface;
1348
    number = host->interface->numberOfInterfaces;
1402
    number = host->interface->numberOfInterfaces;
1349
    for (i = 0, found = 0; i < number && !found; i++) {
1403
    for (i = 0; i < number; i++) {
1350
	if (interface->interface[i].addr == addr &&
1404
        if (interface->interface[i].addr == addr &&
1351
	    interface->interface[i].port == port) {
1405
            interface->interface[i].port == port) {
1352
	    found = 1;
1406
	    if (interface->interface[i].valid)
1353
            interface->interface[i].valid = 0;
1407
		h_DeleteHostFromAddrHashTable_r(addr, port, host);
1354
	}
1408
	    number--;
1355
    }
1409
	    for (; i < number; i++) {
1356
    if (found) {
1410
		interface->interface[i] = interface->interface[i+1];
1357
	number--;
1411
	    }
1358
	for (; i < number; i++) {
1412
	    interface->numberOfInterfaces = number;
1359
	    interface->interface[i] = interface->interface[i+1];
1413
	    return 0;
1360
	}
1414
	}
1361
	interface->numberOfInterfaces = number;
1415
    }  
1362
    }
1416
    /* not found */
1417
    return 0;
1418
}
1419
1420
/*
1421
 * This is called with host locked and held.
1422
 *
1423
 * All addresses are in network byte order.
1424
 */
1425
int
1426
invalidateInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
1427
{
1428
    int i;
1429
    int number;
1430
    struct Interface *interface;
1431
    char hoststr[16], hoststr2[16];
1432
1433
    assert(host);
1434
    assert(host->interface);
1435
    
1436
    ViceLog(125, ("invalidateInterfaceAddr : host 0x%lx (%s:%d) addr %s:%d\n",
1437
                 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1438
                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
1439
                 ntohs(port)));
1363
1440
1364
    /*
1441
    /*
1365
     * Remove the hash table entry for this address
1442
     * Make sure this address is on the list of known addresses
1443
     * for this host.
1366
     */
1444
     */
1367
    hashDelete_r(addr, port, host);
1445
    interface = host->interface;
1368
1446
    number = host->interface->numberOfInterfaces;
1447
    for (i = 0; i < number; i++) {
1448
	if (interface->interface[i].addr == addr &&
1449
            interface->interface[i].port == port) {
1450
	    if (interface->interface[i].valid) {
1451
		h_DeleteHostFromAddrHashTable_r(addr, port, host);
1452
		interface->interface[i].valid = 0;
1453
	    }
1454
	    return 0;
1455
	}
1456
    }
1457
    
1458
    /* not found */
1369
    return 0;
1459
    return 0;
1370
}
1460
}
1371
1461
Lines 1383-1444 removeAddress_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1383
{
1473
{
1384
    int i;
1474
    int i;
1385
    char hoststr[16], hoststr2[16];
1475
    char hoststr[16], hoststr2[16];
1476
    struct rx_connection *rxconn;
1386
1477
1387
    if (!host->interface) {
1478
    if (!host->interface || host->interface->numberOfInterfaces == 1) {
1388
        if (host->host == addr && host->port == port) {
1479
        if (host->host == addr && host->port == port) {
1389
            ViceLog(25,
1480
            ViceLog(25,
1390
                    ("Removing only address for host %x (%s:%d), deleting host.\n",
1481
                    ("Removing only address for host 0x%lx (%s:%d), deleting host.\n",
1391
                     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1482
                     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1392
            host->hostFlags |= HOSTDELETED;
1483
            host->hostFlags |= HOSTDELETED;
1484
            /* 
1485
             * Do not remove the primary addr/port from the hash table.
1486
             * It will be ignored due to the HOSTDELETED flag and will
1487
             * be removed when h_TossStuff_r() cleans up the HOSTDELETED
1488
             * host.  Removing it here will only result in a search for 
1489
             * the host/addr/port in the hash chain which will fail.
1490
             */
1491
	} else {
1492
            ViceLog(0,
1493
                    ("Removing address that does not belong to host 0x%lx (%s:%d).\n",
1494
                     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1393
        }
1495
        }
1394
    } else {
1496
    } else {
1395
        removeInterfaceAddr_r(host, host->host, host->port);
1497
	if (host->host == addr && host->port == port)  {
1396
        if (host->interface->numberOfInterfaces == 0) {
1498
	    removeInterfaceAddr_r(host, addr, port);
1397
            ViceLog(25,
1398
                     ("Removed only address for host %x (%s:%d), no alternate interfaces, deleting host.\n",
1399
                       host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1400
            host->hostFlags |= HOSTDELETED;
1401
        } else {
1402
1499
1403
            for (i=0; i < host->interface->numberOfInterfaces; i++) {
1500
            for (i=0; i < host->interface->numberOfInterfaces; i++) {
1404
                if (host->interface->interface[i].valid) {
1501
                if (host->interface->interface[i].valid) {
1405
                    ViceLog(25,
1502
                    ViceLog(25,
1406
                             ("Removed address for host %x (%s:%d), new primary interface %s:%d.\n",
1503
                             ("Removed address for host 0x%lx (%s:%d), new primary interface %s:%d.\n",
1407
                               host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
1504
                               (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
1408
                               afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr2), 
1505
                               afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr2), 
1409
                               ntohs(host->interface->interface[i].port)));
1506
                               ntohs(host->interface->interface[i].port)));
1410
                    host->host = host->interface->interface[i].addr;
1507
                    host->host = host->interface->interface[i].addr;
1411
                    host->port = host->interface->interface[i].port;
1508
                    host->port = host->interface->interface[i].port;
1412
                    hashInsert_r(host->host, host->port, host);
1509
                    h_AddHostToAddrHashTable_r(host->host, host->port, host);
1413
                    break;
1510
                    break;
1414
                }
1511
                }
1415
            }
1512
            }
1416
1513
1417
            if (i == host->interface->numberOfInterfaces) {
1514
            if (i == host->interface->numberOfInterfaces) {
1418
                ViceLog(25,
1515
                ViceLog(25,
1419
                         ("Removed only address for host %x (%s:%d), no valid alternate interfaces, deleting host.\n",
1516
                         ("Removed only address for host 0x%lx (%s:%d), no valid alternate interfaces, deleting host.\n",
1420
                           host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1517
                          (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1421
                host->hostFlags |= HOSTDELETED;
1518
                host->hostFlags |= HOSTDELETED;
1519
		/* addr/port was removed from the hash table */
1520
		host->host = 0;
1521
		host->port = 0;
1422
            } else {
1522
            } else {
1423
                struct rx_connection *rxconn;
1424
1425
                rxconn = host->callback_rxcon;
1426
                host->callback_rxcon = NULL;
1427
1428
                if (rxconn) {
1429
                    struct client *client;
1430
                    /*
1431
                    * If rx_DestroyConnection calls h_FreeConnection we will
1432
                    * deadlock on the host_glock_mutex. Work around the problem
1433
                    * by unhooking the client from the connection before
1434
                    * destroying the connection.
1435
                    */
1436
                    client = rx_GetSpecific(rxconn, rxcon_client_key);
1437
                    rx_SetSpecific(rxconn, rxcon_client_key, (void *)0);
1438
                    rx_DestroyConnection(rxconn);
1439
		    rxconn = NULL;
1440
                }
1441
1442
                if (!sc)
1523
                if (!sc)
1443
                    sc = rxnull_NewClientSecurityObject();
1524
                    sc = rxnull_NewClientSecurityObject();
1444
                host->callback_rxcon =
1525
                host->callback_rxcon =
Lines 1446-1451 removeAddress_r(struct host *host, afs_uint32 addr, afs_uint16 port) Link Here
1446
                rx_SetConnDeadTime(host->callback_rxcon, 50);
1527
                rx_SetConnDeadTime(host->callback_rxcon, 50);
1447
                rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
1528
                rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
1448
            }
1529
            }
1530
	} else {
1531
	    /* not the primary addr/port, just invalidate it */
1532
	    invalidateInterfaceAddr_r(host, addr, port);
1449
        }
1533
        }
1450
    }
1534
    }
1451
1535
Lines 1527-1534 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1527
             * waited for the lock. */
1611
             * waited for the lock. */
1528
	    h_Unlock_r(host);
1612
	    h_Unlock_r(host);
1529
	    ViceLog(125,
1613
	    ViceLog(125,
1530
		    ("Host %s:%d starting h_Lookup again\n",
1614
		    ("Host 0x%lx (%s:%d) starting h_Lookup again\n",
1531
		     afs_inet_ntoa_r(host->host, hoststr),
1615
		     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1532
		     ntohs(host->port)));
1616
		     ntohs(host->port)));
1533
	    if (!*heldp)
1617
	    if (!*heldp)
1534
		h_Release_r(host);
1618
		h_Release_r(host);
Lines 1594-1601 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1594
		 * that we maintain some extra callback state information */
1678
		 * that we maintain some extra callback state information */
1595
		if (host->interface) {
1679
		if (host->interface) {
1596
		    ViceLog(0,
1680
		    ViceLog(0,
1597
			    ("Host %x (%s:%d) used to support WhoAreYou, deleting.\n",
1681
			    ("Host 0x%lx (%s:%d) used to support WhoAreYou, deleting.\n",
1598
			     host, 
1682
			     (unsigned long) host,
1599
			     afs_inet_ntoa_r(host->host, hoststr),
1683
			     afs_inet_ntoa_r(host->host, hoststr),
1600
			     ntohs(host->port)));
1684
			     ntohs(host->port)));
1601
		    host->hostFlags |= HOSTDELETED;
1685
		    host->hostFlags |= HOSTDELETED;
Lines 1646-1653 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1646
                    removeAddress_r(host, haddr, hport);
1730
                    removeAddress_r(host, haddr, hport);
1647
		} else {
1731
		} else {
1648
		    ViceLog(25,
1732
		    ViceLog(25,
1649
			    ("Uuid doesn't match host %x (%s:%d).\n",
1733
			    ("Uuid doesn't match host 0x%lx (%s:%d).\n",
1650
			     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1734
			     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
1651
		    
1735
		    
1652
		    removeAddress_r(host, host->host, host->port);
1736
		    removeAddress_r(host, host->host, host->port);
1653
		}
1737
		}
Lines 1684-1691 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1684
                     * callback connection, and destroy the old one.
1768
                     * callback connection, and destroy the old one.
1685
                     */
1769
                     */
1686
                    struct rx_connection *rxconn;
1770
                    struct rx_connection *rxconn;
1687
                    ViceLog(0,("CB: ProbeUuid for host %x (%s:%d) failed %d\n",
1771
                    ViceLog(0,("CB: ProbeUuid for host 0x%lx (%s:%d) failed %d\n",
1688
			       host, 
1772
			       (unsigned long) host,
1689
			       afs_inet_ntoa_r(host->host, hoststr),
1773
			       afs_inet_ntoa_r(host->host, hoststr),
1690
			       ntohs(host->port),code2));
1774
			       ntohs(host->port),code2));
1691
		    /*
1775
		    /*
Lines 1736-1743 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1736
		goto gethost_out;
1820
		goto gethost_out;
1737
	    } else {
1821
	    } else {
1738
		ViceLog(0,
1822
		ViceLog(0,
1739
			("CB: WhoAreYou failed for host %x (%s:%d), error %d\n",
1823
			("CB: WhoAreYou failed for host 0x%lx (%s:%d), error %d\n",
1740
			 host, afs_inet_ntoa_r(host->host, hoststr),
1824
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1741
			 ntohs(host->port), code));
1825
			 ntohs(host->port), code));
1742
		host->hostFlags |= VENUSDOWN;
1826
		host->hostFlags |= VENUSDOWN;
1743
	    }
1827
	    }
Lines 1754-1767 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1754
	if (!(host->hostFlags & ALTADDR)) {
1838
	if (!(host->hostFlags & ALTADDR)) {
1755
	    /* another thread is doing the initialisation */
1839
	    /* another thread is doing the initialisation */
1756
	    ViceLog(125,
1840
	    ViceLog(125,
1757
		    ("Host %s:%d waiting for host-init to complete\n",
1841
		    ("Host 0x%lx (%s:%d) waiting for host-init to complete\n",
1758
		     afs_inet_ntoa_r(host->host, hoststr),
1842
		     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1759
		     ntohs(host->port)));
1843
		     ntohs(host->port)));
1760
	    h_Lock_r(host);
1844
	    h_Lock_r(host);
1761
	    h_Unlock_r(host);
1845
	    h_Unlock_r(host);
1762
	    ViceLog(125,
1846
	    ViceLog(125,
1763
		    ("Host %s:%d starting h_Lookup again\n",
1847
		    ("Host 0x%lx (%s:%d) starting h_Lookup again\n",
1764
		     afs_inet_ntoa_r(host->host, hoststr),
1848
		     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1765
		     ntohs(host->port)));
1849
		     ntohs(host->port)));
1766
	    if (!*heldp)
1850
	    if (!*heldp)
1767
		h_Release_r(host);
1851
		h_Release_r(host);
Lines 1782-1789 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1782
	    if (host->interface)
1866
	    if (host->interface)
1783
		afsUUID_to_string(&host->interface->uuid, uuid2, 127);
1867
		afsUUID_to_string(&host->interface->uuid, uuid2, 127);
1784
	    ViceLog(0,
1868
	    ViceLog(0,
1785
		    ("CB: new identity for host %s:%d, deleting(%x %x %s %s)\n",
1869
		    ("CB: new identity for host 0x%lx (%s:%d), deleting(%x %x %s %s)\n",
1786
		     afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
1870
		     (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
1787
		     identP->valid, host->interface,
1871
		     identP->valid, host->interface,
1788
		     identP->valid ? uuid1 : "",
1872
		     identP->valid ? uuid1 : "",
1789
		     host->interface ? uuid2 : ""));
1873
		     host->interface ? uuid2 : ""));
Lines 1829-1836 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1829
		if (!pident)
1913
		if (!pident)
1830
		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
1914
		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
1831
		ViceLog(25,
1915
		ViceLog(25,
1832
			("Host %s:%d does not support WhoAreYou.\n",
1916
			("Host 0x%lx (%s:%d) does not support WhoAreYou.\n",
1833
			 afs_inet_ntoa_r(host->host, hoststr),
1917
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1834
			 ntohs(host->port)));
1918
			 ntohs(host->port)));
1835
		code = 0;
1919
		code = 0;
1836
	    } else if (code == 0) {
1920
	    } else if (code == 0) {
Lines 1850-1857 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1850
		if (!pident)
1934
		if (!pident)
1851
		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
1935
		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
1852
		ViceLog(25,
1936
		ViceLog(25,
1853
			("WhoAreYou success on %s:%d\n",
1937
			("WhoAreYou success on 0x%lx (%s:%d)\n",
1854
			 afs_inet_ntoa_r(host->host, hoststr),
1938
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1855
			 ntohs(host->port)));
1939
			 ntohs(host->port)));
1856
	    }
1940
	    }
1857
	    if (code == 0 && !identP->valid) {
1941
	    if (code == 0 && !identP->valid) {
Lines 1906-1913 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1906
			     * MultiProbeAlternateAddress_r() will remove the
1990
			     * MultiProbeAlternateAddress_r() will remove the
1907
			     * alternate interfaces that do not have the same
1991
			     * alternate interfaces that do not have the same
1908
			     * Uuid. */
1992
			     * Uuid. */
1909
			    ViceLog(0,("CB: ProbeUuid for %s:%d failed %d\n",
1993
			    ViceLog(0,("CB: ProbeUuid for 0x%lx (%s:%d) failed %d\n",
1910
					 afs_inet_ntoa_r(oldHost->host, hoststr),
1994
                                        (unsigned long) oldHost, afs_inet_ntoa_r(oldHost->host, hoststr),
1911
					 ntohs(oldHost->port),code2));
1995
					 ntohs(oldHost->port),code2));
1912
			    MultiProbeAlternateAddress_r(oldHost);
1996
			    MultiProbeAlternateAddress_r(oldHost);
1913
                            probefail = 1;
1997
                            probefail = 1;
Lines 1927-1934 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1927
			struct rx_connection *rxconn;
2011
			struct rx_connection *rxconn;
1928
2012
1929
			ViceLog(25,
2013
			ViceLog(25,
1930
				("CB: Host %x (%s:%d) has new addr %s:%d\n",
2014
				("CB: Host 0x%lx (%s:%d) has new addr %s:%d\n",
1931
				  oldHost, 
2015
                                  (unsigned long) oldHost,
1932
                                  afs_inet_ntoa_r(oldHost->host, hoststr2),
2016
                                  afs_inet_ntoa_r(oldHost->host, hoststr2),
1933
				  ntohs(oldHost->port),
2017
				  ntohs(oldHost->port),
1934
                                  afs_inet_ntoa_r(haddr, hoststr),
2018
                                  afs_inet_ntoa_r(haddr, hoststr),
Lines 1947-1969 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1947
			     */
2031
			     */
1948
			    removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
2032
			    removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
1949
			} else {
2033
			} else {
1950
			    int i, found;
2034
			    int i;
1951
			    struct Interface *interface = oldHost->interface;
2035
			    struct Interface *interface = oldHost->interface;
1952
			    int number = oldHost->interface->numberOfInterfaces;
2036
			    int number = oldHost->interface->numberOfInterfaces;
1953
			    for (i = 0, found = 0; i < number; i++) {
2037
			    for (i = 0; i < number; i++) {
1954
				if (interface->interface[i].addr == haddr &&
2038
				if (interface->interface[i].addr == haddr &&
1955
				    interface->interface[i].port != hport) {
2039
				    interface->interface[i].port != hport) {
1956
				    found = 1;
2040
				    /* 
2041
				     * We have just been contacted by a client
2042
				     * that has been seen from behind a NAT 
2043
				     * and at least one other address.
2044
				     */
2045
				    removeInterfaceAddr_r(oldHost, haddr, 
2046
					interface->interface[i].port);
1957
				    break;
2047
				    break;
1958
				}
2048
				}
1959
			    }
2049
			    }
1960
			    if (found) {
1961
				/* We have just been contacted by a client that has been
1962
				 * seen from behind a NAT and at least one other address.
1963
				 */
1964
				removeInterfaceAddr_r(oldHost, haddr, interface->interface[i].port);
1965
			    }
1966
			}
2050
			}
2051
			h_AddHostToAddrHashTable_r(haddr, hport, oldHost);
1967
			oldHost->host = haddr;
2052
			oldHost->host = haddr;
1968
			oldHost->port = hport;
2053
			oldHost->port = hport;
1969
			rxconn = oldHost->callback_rxcon;
2054
			rxconn = oldHost->callback_rxcon;
Lines 1982-1988 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1982
		    /* the new host is held and locked */
2067
		    /* the new host is held and locked */
1983
		} else {
2068
		} else {
1984
		    /* This really is a new host */
2069
		    /* This really is a new host */
1985
		    hashInsertUuid_r(&identP->uuid, host);
2070
		    h_AddHostToUuidHashTable_r(&identP->uuid, host);
1986
		    cb_conn = host->callback_rxcon;
2071
		    cb_conn = host->callback_rxcon;
1987
		    rx_GetConnection(cb_conn);		
2072
		    rx_GetConnection(cb_conn);		
1988
		    H_UNLOCK;
2073
		    H_UNLOCK;
Lines 1994-2001 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
1994
		    H_LOCK;
2079
		    H_LOCK;
1995
		    if (code == 0) {
2080
		    if (code == 0) {
1996
			ViceLog(25,
2081
			ViceLog(25,
1997
				("InitCallBackState3 success on %s:%d\n",
2082
				("InitCallBackState3 success on 0x%lx (%s:%d)\n",
1998
				 afs_inet_ntoa_r(host->host, hoststr),
2083
				 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
1999
				 ntohs(host->port)));
2084
				 ntohs(host->port)));
2000
			assert(interfValid == 1);
2085
			assert(interfValid == 1);
2001
			initInterfaceAddr_r(host, &interf);
2086
			initInterfaceAddr_r(host, &interf);
Lines 2004-2016 h_GetHost_r(struct rx_connection *tcon, int *heldp) Link Here
2004
	    }
2089
	    }
2005
	    if (code) {
2090
	    if (code) {
2006
		ViceLog(0,
2091
		ViceLog(0,
2007
			("CB: RCallBackConnectBack failed for host %x (%s:%d)\n",
2092
			("CB: RCallBackConnectBack failed for host 0x%lx (%s:%d)\n",
2008
			 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
2093
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
2009
		host->hostFlags |= VENUSDOWN;
2094
		host->hostFlags |= VENUSDOWN;
2010
	    } else {
2095
	    } else {
2011
		ViceLog(125,
2096
		ViceLog(125,
2012
			("CB: RCallBackConnectBack succeeded for host %x (%s:%d)\n",
2097
			("CB: RCallBackConnectBack succeeded for host 0x%lx (%s:%d)\n",
2013
			 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
2098
			 (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
2014
		host->hostFlags |= RESETDONE;
2099
		host->hostFlags |= RESETDONE;
2015
	    }
2100
	    }
2016
	}
2101
	}
Lines 2358-2365 h_FindClient_r(struct rx_connection *tcon) Link Here
2358
	    if (code) {
2443
	    if (code) {
2359
		char hoststr[16];
2444
		char hoststr[16];
2360
		ViceLog(0,
2445
		ViceLog(0,
2361
			("pr_GetCPS failed(%d) for user %d, host %s:%d\n",
2446
			("pr_GetCPS failed(%d) for user %d, host 0x%lx (%s:%d)\n",
2362
			 code, viceid, afs_inet_ntoa_r(client->host->host,
2447
			 code, viceid, (unsigned long) client->host, afs_inet_ntoa_r(client->host->host,
2363
						       hoststr),
2448
						       hoststr),
2364
			 ntohs(client->host->port)));
2449
			 ntohs(client->host->port)));
2365
2450
Lines 2582-2589 h_PrintClient(register struct host *host, int held, StreamHandle_t * file) Link Here
2582
    char tmpStr[256];
2667
    char tmpStr[256];
2583
    char tbuffer[32];
2668
    char tbuffer[32];
2584
    char hoststr[16];
2669
    char hoststr[16];
2670
    time_t LastCall, expTime;
2585
2671
2586
    H_LOCK;
2672
    H_LOCK;
2673
    LastCall = host->LastCall;
2587
    if (host->hostFlags & HOSTDELETED) {
2674
    if (host->hostFlags & HOSTDELETED) {
2588
	H_UNLOCK;
2675
	H_UNLOCK;
2589
	return held;
2676
	return held;
Lines 2592-2602 h_PrintClient(register struct host *host, int held, StreamHandle_t * file) Link Here
2592
		       "Host %s:%d down = %d, LastCall %s",
2679
		       "Host %s:%d down = %d, LastCall %s",
2593
		       afs_inet_ntoa_r(host->host, hoststr),
2680
		       afs_inet_ntoa_r(host->host, hoststr),
2594
		       ntohs(host->port), (host->hostFlags & VENUSDOWN),
2681
		       ntohs(host->port), (host->hostFlags & VENUSDOWN),
2595
		       afs_ctime((time_t *) & host->LastCall, tbuffer,
2682
		       afs_ctime(&LastCall, tbuffer,
2596
				 sizeof(tbuffer)));
2683
				 sizeof(tbuffer)));
2597
    (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
2684
    (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
2598
    for (client = host->FirstClient; client; client = client->next) {
2685
    for (client = host->FirstClient; client; client = client->next) {
2599
	if (!client->deleted) {
2686
	if (!client->deleted) {
2687
                expTime = client->expTime;
2600
		(void)afs_snprintf(tmpStr, sizeof tmpStr,
2688
		(void)afs_snprintf(tmpStr, sizeof tmpStr,
2601
				   "    user id=%d,  name=%s, sl=%s till %s",
2689
				   "    user id=%d,  name=%s, sl=%s till %s",
2602
				   client->ViceId, h_UserName(client),
2690
				   client->ViceId, h_UserName(client),
Lines 2604-2611 h_PrintClient(register struct host *host, int held, StreamHandle_t * file) Link Here
2604
				   authClass ? "Authenticated" :
2692
				   authClass ? "Authenticated" :
2605
				   "Not authenticated",
2693
				   "Not authenticated",
2606
				   client->
2694
				   client->
2607
				   authClass ? afs_ctime((time_t *) & client->
2695
				   authClass ? afs_ctime(&expTime, tbuffer,
2608
							 expTime, tbuffer,
2609
							 sizeof(tbuffer))
2696
							 sizeof(tbuffer))
2610
				   : "No Limit\n");
2697
				   : "No Limit\n");
2611
		(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
2698
		(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
Lines 3012-3018 CheckHost(register struct host *host, int held) Link Here
3012
		     * back state, because break delayed callbacks (called when a
3099
		     * back state, because break delayed callbacks (called when a
3013
		     * message is received from the workstation) will always send a 
3100
		     * message is received from the workstation) will always send a 
3014
		     * break all call backs to the workstation if there is no
3101
		     * break all call backs to the workstation if there is no
3015
		     *callback.
3102
		     * callback.
3016
		     */
3103
		     */
3017
		}
3104
		}
3018
	    } else {
3105
	    } else {
Lines 3105-3111 CheckHost_r(register struct host *host, int held, char *dummy) Link Here
3105
		     * back state, because break delayed callbacks (called when a
3192
		     * back state, because break delayed callbacks (called when a
3106
		     * message is received from the workstation) will always send a 
3193
		     * message is received from the workstation) will always send a 
3107
		     * break all call backs to the workstation if there is no
3194
		     * break all call backs to the workstation if there is no
3108
		     *callback.
3195
		     * callback.
3109
		     */
3196
		     */
3110
		}
3197
		}
3111
	    } else {
3198
	    } else {
Lines 3178-3186 h_CheckHosts() Link Here
3178
3265
3179
/*
3266
/*
3180
 * This is called with host locked and held. At this point, the
3267
 * This is called with host locked and held. At this point, the
3181
 * hostAddrHashTable should not have any entries for the alternate
3268
 * hostAddrHashTable has an entry for the primary addr/port inserted
3182
 * interfaces. This function has to insert these entries in the
3269
 * by h_Alloc_r().  No other interfaces should be considered valid.
3183
 * hostAddrHashTable.
3184
 *
3270
 *
3185
 * The addresses in the interfaceAddr list are in host byte order.
3271
 * The addresses in the interfaceAddr list are in host byte order.
3186
 */
3272
 */
Lines 3298-3304 initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) Link Here
3298
	 * are coming from fully connected hosts (no NAT/PATs)
3384
	 * are coming from fully connected hosts (no NAT/PATs)
3299
	 */
3385
	 */
3300
	interface->interface[i].port = port7001;
3386
	interface->interface[i].port = port7001;
3301
        interface->interface[i].valid = 1;      /* valid until a conflict is found */
3387
	interface->interface[i].valid = 
3388
	    (interf->addr_in[i] == myAddr && port7001 == myPort) ? 1 : 0;
3302
    }
3389
    }
3303
3390
3304
    interface->uuid = interf->uuid;
3391
    interface->uuid = interf->uuid;
Lines 3306-3318 initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) Link Here
3306
    assert(!host->interface);
3393
    assert(!host->interface);
3307
    host->interface = interface;
3394
    host->interface = interface;
3308
3395
3309
    afsUUID_to_string(&interface->uuid, uuidstr, 127);
3396
    if (LogLevel >= 125) {
3310
3397
	afsUUID_to_string(&interface->uuid, uuidstr, 127);
3311
    ViceLog(125, ("--- uuid %s\n", uuidstr));
3398
       
3312
    for (i = 0; i < host->interface->numberOfInterfaces; i++) {
3399
	ViceLog(125, ("--- uuid %s\n", uuidstr));
3313
	ViceLog(125, ("--- alt address %s:%d\n", 
3400
	for (i = 0; i < host->interface->numberOfInterfaces; i++) {
3314
		       afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
3401
	    ViceLog(125, ("--- alt address %s:%d\n", 
3315
		       ntohs(host->interface->interface[i].port)));
3402
		afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
3403
		ntohs(host->interface->interface[i].port)));
3404
	}
3316
    }
3405
    }
3317
3406
3318
    return 0;
3407
    return 0;
Lines 3321-3344 initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) Link Here
3321
/* deleted a HashChain structure for this address and host */
3410
/* deleted a HashChain structure for this address and host */
3322
/* returns 1 on success */
3411
/* returns 1 on success */
3323
int
3412
int
3324
hashDelete_r(afs_uint32 addr, afs_uint16 port, struct host *
3413
h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, 
3325
				host)
3414
                               struct host *host)
3326
{
3415
{
3327
    int flag = 0;
3416
    char hoststr[16];
3328
    register struct h_AddrHashChain **hp, *th;
3417
    register struct h_AddrHashChain **hp, *th;
3329
3418
3330
    for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp);) {
3419
    if (addr == 0 && port == 0)
3420
	return 1;
3421
3422
    for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp); 
3423
	hp = &th->next) {
3331
	assert(th->hostPtr);
3424
	assert(th->hostPtr);
3332
	if (th->hostPtr == host && th->addr == addr && th->port == port) {
3425
	if (th->hostPtr == host && th->addr == addr && th->port == port) {
3426
	    ViceLog(125, ("h_DeleteHostFromAddrHashTable_r: host 0x%lx (%s:%d)\n",
3427
                         (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
3428
                         ntohs(host->port)));
3333
	    *hp = th->next;
3429
	    *hp = th->next;
3334
	    free(th);
3430
	    free(th);
3335
	    flag = 1;
3431
	    return 1;
3336
	    break;
3432
        }
3337
	} else {
3338
	    hp = &th->next;
3339
	}
3340
    }
3433
    }
3341
    return flag;
3434
    ViceLog(125, 
3435
           ("h_DeleteHostFromAddrHashTable_r: host 0x%lx (%s:%d) not found\n",
3436
            (unsigned long) host, afs_inet_ntoa_r(host->host, hoststr),
3437
            ntohs(host->port)));
3438
    return 0;
3342
}
3439
}
3343
3440
3344
3441
Lines 3355-3363 printInterfaceAddr(struct host *host, int level) Link Here
3355
    if (host->interface) {
3452
    if (host->interface) {
3356
	/* check alternate addresses */
3453
	/* check alternate addresses */
3357
	number = host->interface->numberOfInterfaces;
3454
	number = host->interface->numberOfInterfaces;
3358
        if (number == 0)
3455
        if (number == 0) {
3359
            ViceLog(level, ("no-addresses "));
3456
            ViceLog(level, ("no-addresses "));
3360
        else {
3457
        } else {
3361
            for (i = 0; i < number; i++)
3458
            for (i = 0; i < number; i++)
3362
                ViceLog(level, ("%s:%d ", afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
3459
                ViceLog(level, ("%s:%d ", afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
3363
                                ntohs(host->interface->interface[i].port)));
3460
                                ntohs(host->interface->interface[i].port)));
(-)a/src/viced/host.h (-5 / +4 lines)
Lines 176-181 extern char *h_UserName(struct client *client); Link Here
176
#define h_holdbit()  ( 1<<h_holdIndex() )
176
#define h_holdbit()  ( 1<<h_holdIndex() )
177
177
178
#define h_Hold_r(host)   ((host)->holds[h_holdSlot()] |= h_holdbit())
178
#define h_Hold_r(host)   ((host)->holds[h_holdSlot()] |= h_holdbit())
179
#define h_Decrement_r(host) ((host)->holds[h_holdSlot()] &= ~h_holdbit())
179
extern int h_Release(register struct host *host);
180
extern int h_Release(register struct host *host);
180
extern int h_Release_r(register struct host *host);
181
extern int h_Release_r(register struct host *host);
181
182
Lines 207-214 extern struct host *h_Alloc(register struct rx_connection *r_con); Link Here
207
extern struct host *h_Alloc_r(register struct rx_connection *r_con);
208
extern struct host *h_Alloc_r(register struct rx_connection *r_con);
208
extern int h_Lookup_r(afs_uint32 hostaddr, afs_uint16 hport,
209
extern int h_Lookup_r(afs_uint32 hostaddr, afs_uint16 hport,
209
			       int *heldp, struct host **hostp);
210
			       int *heldp, struct host **hostp);
210
extern void   hashInsert_r(afs_uint32 addr, afs_uint16 port, 
211
			   struct host* host);
212
extern struct host *h_LookupUuid_r(afsUUID * uuidp);
211
extern struct host *h_LookupUuid_r(afsUUID * uuidp);
213
extern void h_Enumerate(int (*proc) (), char *param);
212
extern void h_Enumerate(int (*proc) (), char *param);
214
extern struct host *h_GetHost_r(struct rx_connection *tcon, int *heldp);
213
extern struct host *h_GetHost_r(struct rx_connection *tcon, int *heldp);
Lines 222-230 extern void h_PrintClients(); Link Here
222
extern void h_GetWorkStats();
221
extern void h_GetWorkStats();
223
extern void h_flushhostcps(register afs_uint32 hostaddr,
222
extern void h_flushhostcps(register afs_uint32 hostaddr,
224
			   register afs_uint16 hport);
223
			   register afs_uint16 hport);
225
extern void hashInsertUuid_r(struct afsUUID *uuid, struct host *host);
224
extern void h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host);
226
extern void hashInsert_r(afs_uint32 addr, afs_uint16 port, struct host *host);
225
extern void h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host);
227
extern int hashDelete_r(afs_uint32 addr, afs_uint16 port, struct host *host);
226
extern int h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host);
228
extern int initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf);
227
extern int initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf);
229
extern int addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port);
228
extern int addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port);
230
extern int removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port);
229
extern int removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port);
(-)a/src/vlserver/vlclient.c (-1 / +2 lines)
Lines 1313-1320 dump_stats(stats, vital_header) Link Here
1313
{
1313
{
1314
    int i;
1314
    int i;
1315
    char strg[30];
1315
    char strg[30];
1316
    time_t start_time = stats->start_time;
1316
1317
1317
    strncpy(strg, ctime((time_t *) & stats->start_time), sizeof(strg));
1318
    strncpy(strg, ctime(&start_time), sizeof(strg));
1318
    strg[strlen(strg) - 1] = 0;
1319
    strg[strlen(strg) - 1] = 0;
1319
    printf("Dynamic statistics stats (starting time: %s):\n", strg);
1320
    printf("Dynamic statistics stats (starting time: %s):\n", strg);
1320
    printf("OpcodeName\t# Requests\t# Aborts\n");
1321
    printf("OpcodeName\t# Requests\t# Aborts\n");
(-)a/src/vol/vnode.c (-4 / +5 lines)
Lines 379-388 VAllocVnode_r(Error * ec, Volume * vp, VnodeType type) Link Here
379
#endif /* AFS_PTHREAD_ENV */
379
#endif /* AFS_PTHREAD_ENV */
380
	/* Sanity check:  is this vnode really not in use? */
380
	/* Sanity check:  is this vnode really not in use? */
381
	{
381
	{
382
	    int size;
382
	    afs_sfsize_t size;
383
	    IHandle_t *ihP = vp->vnodeIndex[class].handle;
383
	    IHandle_t *ihP = vp->vnodeIndex[class].handle;
384
	    FdHandle_t *fdP;
384
	    FdHandle_t *fdP;
385
	    off_t off = vnodeIndexOffset(vcp, vnodeNumber);
385
	    afs_foff_t off = vnodeIndexOffset(vcp, vnodeNumber);
386
386
387
	    VOL_UNLOCK;
387
	    VOL_UNLOCK;
388
	    fdP = IH_OPEN(ihP);
388
	    fdP = IH_OPEN(ihP);
Lines 671-677 VPutVnode(Error * ec, register Vnode * vnp) Link Here
671
void
671
void
672
VPutVnode_r(Error * ec, register Vnode * vnp)
672
VPutVnode_r(Error * ec, register Vnode * vnp)
673
{
673
{
674
    int writeLocked, offset;
674
    int writeLocked;
675
    afs_foff_t offset;
675
    VnodeClass class;
676
    VnodeClass class;
676
    struct VnodeClassInfo *vcp;
677
    struct VnodeClassInfo *vcp;
677
    int code;
678
    int code;
Lines 859-865 VVnodeWriteToRead_r(Error * ec, register Vnode * vnp) Link Here
859
	} else {
860
	} else {
860
	    IHandle_t *ihP = vp->vnodeIndex[class].handle;
861
	    IHandle_t *ihP = vp->vnodeIndex[class].handle;
861
	    FdHandle_t *fdP;
862
	    FdHandle_t *fdP;
862
	    off_t off = vnodeIndexOffset(vcp, vnp->vnodeNumber);
863
	    afs_foff_t off = vnodeIndexOffset(vcp, vnp->vnodeNumber);
863
	    VOL_UNLOCK;
864
	    VOL_UNLOCK;
864
	    fdP = IH_OPEN(ihP);
865
	    fdP = IH_OPEN(ihP);
865
	    if (fdP == NULL)
866
	    if (fdP == NULL)
(-)a/src/vol/vol-info.c (-9 / +10 lines)
Lines 480-494 HandleVolume(struct DiskPartition64 *dp, char *name) Link Here
480
480
481
	if (dheader) {
481
	if (dheader) {
482
	    FdHandle_t *fdP;
482
	    FdHandle_t *fdP;
483
	    int size = 0;
483
	    afs_sfsize_t size = 0;
484
	    int code;
484
	    afs_sfsize_t code;
485
485
486
	    if (afs_fstat(fd, &stat) == -1) {
486
	    if (afs_fstat(fd, &stat) == -1) {
487
		perror("stat");
487
		perror("stat");
488
		exit(1);
488
		exit(1);
489
	    }
489
	    }
490
	    if (!dsizeOnly && !saveinodes) {
490
	    if (!dsizeOnly && !saveinodes) {
491
		printf("Volume header (size = %d):\n", size = stat.st_size);
491
		size = stat.st_size;
492
		printf("Volume header (size = %d):\n", (int)size);
492
		printf("\tstamp\t= 0x%x\n", header.stamp.version);
493
		printf("\tstamp\t= 0x%x\n", header.stamp.version);
493
		printf("\tVolId\t= %u\n", header.id);
494
		printf("\tVolId\t= %u\n", header.id);
494
	    }
495
	    }
Lines 510-516 HandleVolume(struct DiskPartition64 *dp, char *name) Link Here
510
	    if (!dsizeOnly && !saveinodes) {
511
	    if (!dsizeOnly && !saveinodes) {
511
		printf("\tparent\t= %u\n", header.parent);
512
		printf("\tparent\t= %u\n", header.parent);
512
		printf("\tInfo inode\t= %s (size = %d)\n",
513
		printf("\tInfo inode\t= %s (size = %d)\n",
513
		       PrintInode(NULL, header.volumeInfo), code);
514
		       PrintInode(NULL, header.volumeInfo), (int)code);
514
	    }
515
	    }
515
516
516
	    IH_INIT(ih, dp->device, header.parent, header.smallVnodeIndex);
517
	    IH_INIT(ih, dp->device, header.parent, header.smallVnodeIndex);
Lines 529-535 HandleVolume(struct DiskPartition64 *dp, char *name) Link Here
529
	    size += code;
530
	    size += code;
530
	    if (!dsizeOnly && !saveinodes) {
531
	    if (!dsizeOnly && !saveinodes) {
531
		printf("\tSmall inode\t= %s (size = %d)\n",
532
		printf("\tSmall inode\t= %s (size = %d)\n",
532
		       PrintInode(NULL, header.smallVnodeIndex), code);
533
		       PrintInode(NULL, header.smallVnodeIndex), (int)code);
533
	    }
534
	    }
534
535
535
	    IH_INIT(ih, dp->device, header.parent, header.largeVnodeIndex);
536
	    IH_INIT(ih, dp->device, header.parent, header.largeVnodeIndex);
Lines 548-556 HandleVolume(struct DiskPartition64 *dp, char *name) Link Here
548
	    size += code;
549
	    size += code;
549
	    if (!dsizeOnly && !saveinodes) {
550
	    if (!dsizeOnly && !saveinodes) {
550
		printf("\tLarge inode\t= %s (size = %d)\n",
551
		printf("\tLarge inode\t= %s (size = %d)\n",
551
		       PrintInode(NULL, header.largeVnodeIndex), code);
552
		       PrintInode(NULL, header.largeVnodeIndex), (int)code);
552
#ifndef AFS_NT40_ENV
553
#ifndef AFS_NT40_ENV
553
		printf("Total aux volume size = %d\n\n", size);
554
		printf("Total aux volume size = %d\n\n", (int)size);
554
#endif
555
#endif
555
	    }
556
	    }
556
#ifdef AFS_NAMEI_ENV
557
#ifdef AFS_NAMEI_ENV
Lines 570-577 HandleVolume(struct DiskPartition64 *dp, char *name) Link Here
570
	    size += code;
571
	    size += code;
571
	    if (!dsizeOnly && !saveinodes) {
572
	    if (!dsizeOnly && !saveinodes) {
572
		printf("\tLink inode\t= %s (size = %d)\n",
573
		printf("\tLink inode\t= %s (size = %d)\n",
573
		       PrintInode(NULL, header.linkTable), code);
574
		       PrintInode(NULL, header.linkTable), (int)code);
574
		printf("Total aux volume size = %d\n\n", size);
575
		printf("Total aux volume size = %d\n\n", (int)size);
575
	    }
576
	    }
576
#endif
577
#endif
577
	    Vauxsize = size;
578
	    Vauxsize = size;
(-)a/src/vol/vol-salvage.c (-9 / +414 lines)
Lines 188-193 Vnodes with 0 inode pointers in RW volumes are now deleted. Link Here
188
#include "viceinode.h"
188
#include "viceinode.h"
189
#include "salvage.h"
189
#include "salvage.h"
190
#include "volinodes.h"		/* header magic number, etc. stuff */
190
#include "volinodes.h"		/* header magic number, etc. stuff */
191
#include <afs/acl.h>
192
#include <afs/prs_fs.h>
193
191
#ifdef AFS_NT40_ENV
194
#ifdef AFS_NT40_ENV
192
#include <pthread.h>
195
#include <pthread.h>
193
#endif
196
#endif
Lines 326-333 struct VolumeSummary { /* Volume summary an entry for each Link Here
326
329
327
struct VnodeInfo {
330
struct VnodeInfo {
328
    IHandle_t *handle;		/* Inode containing this index */
331
    IHandle_t *handle;		/* Inode containing this index */
329
    int nVnodes;		/* Total number of vnodes in index */
332
    afs_sfsize_t nVnodes;		/* Total number of vnodes in index */
330
    int nAllocatedVnodes;	/* Total number actually used */
333
    afs_sfsize_t nAllocatedVnodes;	/* Total number actually used */
331
    int volumeBlockCount;	/* Total number of blocks used by volume */
334
    int volumeBlockCount;	/* Total number of blocks used by volume */
332
    Inode *inodes;		/* Directory only */
335
    Inode *inodes;		/* Directory only */
333
    struct VnodeEssence {
336
    struct VnodeEssence {
Lines 2618-2625 SalvageIndex(Inode ino, VnodeClass class, int RW, Link Here
2618
    StreamHandle_t *file;
2621
    StreamHandle_t *file;
2619
    struct VnodeClassInfo *vcp;
2622
    struct VnodeClassInfo *vcp;
2620
    afs_sfsize_t size;
2623
    afs_sfsize_t size;
2624
    afs_sfsize_t nVnodes;
2621
    afs_fsize_t vnodeLength;
2625
    afs_fsize_t vnodeLength;
2622
    int vnodeIndex, nVnodes;
2626
    int vnodeIndex;
2623
    afs_ino_str_t stmp1, stmp2;
2627
    afs_ino_str_t stmp1, stmp2;
2624
    IHandle_t *handle;
2628
    IHandle_t *handle;
2625
    FdHandle_t *fdP;
2629
    FdHandle_t *fdP;
Lines 2825-2835 SalvageIndex(Inode ino, VnodeClass class, int RW, Link Here
2825
			}
2829
			}
2826
			if (VNDISK_GET_INO(vnode)) {
2830
			if (VNDISK_GET_INO(vnode)) {
2827
			    if (!Showmode) {
2831
			    if (!Showmode) {
2828
				Log("Vnode %d (unique %u): corresponding inode %s is missing; vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, PrintInode(NULL, VNDISK_GET_INO(vnode)), ctime((time_t *) & (vnode->serverModifyTime)));
2832
				time_t serverModifyTime = vnode->serverModifyTime;
2833
				Log("Vnode %d (unique %u): corresponding inode %s is missing; vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, PrintInode(NULL, VNDISK_GET_INO(vnode)), ctime(&serverModifyTime));
2829
			    }
2834
			    }
2830
			} else {
2835
			} else {
2831
			    if (!Showmode)
2836
			    if (!Showmode) {
2832
				Log("Vnode %d (unique %u): bad directory vnode (no inode number listed); vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, ctime((time_t *) & (vnode->serverModifyTime)));
2837
				time_t serverModifyTime = vnode->serverModifyTime;
2838
				Log("Vnode %d (unique %u): bad directory vnode (no inode number listed); vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, ctime(&serverModifyTime));
2839
                            }
2833
			}
2840
			}
2834
			memset(vnode, 0, vcp->diskSize);
2841
			memset(vnode, 0, vcp->diskSize);
2835
			vnodeChanged = 1;
2842
			vnodeChanged = 1;
Lines 3169-3175 JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber, Link Here
3169
	    Log("FOUND suid/sgid file: %s/%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
3176
	    Log("FOUND suid/sgid file: %s/%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
3170
	if (/* ShowMounts && */ (vnodeEssence->type == vSymlink)
3177
	if (/* ShowMounts && */ (vnodeEssence->type == vSymlink)
3171
	    && !(vnodeEssence->modeBits & 0111)) {
3178
	    && !(vnodeEssence->modeBits & 0111)) {
3172
	    int code, size;
3179
	    int code;
3180
	    afs_sfsize_t size;
3173
	    char buf[1025];
3181
	    char buf[1025];
3174
	    IHandle_t *ihP;
3182
	    IHandle_t *ihP;
3175
	    FdHandle_t *fdP;
3183
	    FdHandle_t *fdP;
Lines 3459-3464 SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo, Link Here
3459
    return;
3467
    return;
3460
}
3468
}
3461
3469
3470
/**
3471
 * Get a new FID that can be used to create a new file.
3472
 *
3473
 * @param[in] volHeader vol header for the volume
3474
 * @param[in] class     what type of vnode we'll be creating (vLarge or vSmall)
3475
 * @param[out] afid     the FID that we can use (only Vnode and Unique are set)
3476
 * @param[inout] maxunique  max uniquifier for all vnodes in the volume;
3477
 *                          updated to the new max unique if we create a new
3478
 *                          vnode
3479
 */
3480
static void
3481
GetNewFID(VolumeDiskData *volHeader, VnodeClass class, AFSFid *afid,
3482
          Unique *maxunique)
3483
{
3484
    int i;
3485
    for (i = 0; i < vnodeInfo[class].nVnodes; i++) {
3486
	if (vnodeInfo[class].vnodes[i].type == vNull) {
3487
	    break;
3488
	}
3489
    }
3490
    if (i == vnodeInfo[class].nVnodes) {
3491
	/* no free vnodes; make a new one */
3492
	vnodeInfo[class].nVnodes++;
3493
	vnodeInfo[class].vnodes = realloc(vnodeInfo[class].vnodes,
3494
	                                  sizeof(struct VnodeEssence) * (i+1));
3495
	vnodeInfo[class].vnodes[i].type = vNull;
3496
    }
3497
3498
    afid->Vnode = bitNumberToVnodeNumber(i, class);
3499
3500
    if (volHeader->uniquifier < (*maxunique + 1)) {
3501
	/* header uniq is bad; it will get bumped by 2000 later */
3502
	afid->Unique = *maxunique + 1 + 2000;
3503
	(*maxunique)++;
3504
    } else {
3505
	/* header uniq seems okay; just use that */
3506
	afid->Unique = *maxunique = volHeader->uniquifier++;
3507
    }
3508
}
3509
3510
/**
3511
 * Create a vnode for a README file explaining not to use a recreated-root vol.
3512
 *
3513
 * @param[in] volHeader vol header for the volume
3514
 * @param[in] alinkH    ihandle for i/o for the volume
3515
 * @param[in] vid       volume id
3516
 * @param[inout] maxunique  max uniquifier for all vnodes in the volume;
3517
 *                          updated to the new max unique if we create a new
3518
 *                          vnode
3519
 * @param[out] afid     FID for the new readme vnode
3520
 * @param[out] ainode   the inode for the new readme file
3521
 *
3522
 * @return operation status
3523
 *  @retval 0 success
3524
 *  @retval -1 error
3525
 */
3526
static int
3527
CreateReadme(VolumeDiskData *volHeader, IHandle_t *alinkH,
3528
             VolumeId vid, Unique *maxunique, AFSFid *afid, Inode *ainode)
3529
{
3530
    Inode readmeinode;
3531
    struct VnodeDiskObject *rvnode = NULL;
3532
    afs_sfsize_t bytes;
3533
    IHandle_t *readmeH = NULL;
3534
    struct VnodeEssence *vep;
3535
    afs_fsize_t length;
3536
    time_t now = time(NULL);
3537
3538
    /* Try to make the note brief, but informative. Only administrators should
3539
     * be able to read this file at first, so we can hopefully assume they
3540
     * know what AFS is, what a volume is, etc. */
3541
    char readme[] =
3542
"This volume has been salvaged, but has lost its original root directory.\n"
3543
"The root directory that exists now has been recreated from orphan files\n"
3544
"from the rest of the volume. This recreated root directory may interfere\n"
3545
"with old cached data on clients, and there is no way the salvager can\n"
3546
"reasonably prevent that. So, it is recommended that you do not continue to\n"
3547
"use this volume, but only copy the salvaged data to a new volume.\n"
3548
"Continuing to use this volume as it exists now may cause some clients to\n"
3549
"behave oddly when accessing this volume.\n"
3550
"\n\t -- Your friendly neighborhood OpenAFS salvager\n";
3551
    /* ^ the person reading this probably just lost some data, so they could
3552
     * use some cheering up. */
3553
3554
    /* -1 for the trailing NUL */
3555
    length = sizeof(readme) - 1;
3556
3557
    GetNewFID(volHeader, vSmall, afid, maxunique);
3558
3559
    vep = &vnodeInfo[vSmall].vnodes[vnodeIdToBitNumber(afid->Vnode)];
3560
3561
    /* create the inode and write the contents */
3562
    readmeinode = IH_CREATE(alinkH, fileSysDevice, fileSysPath, 0, vid,
3563
                            afid->Vnode, afid->Unique, 1);
3564
    if (!VALID_INO(readmeinode)) {
3565
	Log("CreateReadme: readme IH_CREATE failed\n");
3566
	goto error;
3567
    }
3568
3569
    IH_INIT(readmeH, fileSysDevice, vid, readmeinode);
3570
    bytes = IH_IWRITE(readmeH, 0, readme, length);
3571
    IH_RELEASE(readmeH);
3572
3573
    if (bytes != length) {
3574
	Log("CreateReadme: IWRITE failed (%d/%d)\n", (int)bytes,
3575
	    (int)sizeof(readme));
3576
	goto error;
3577
    }
3578
3579
    /* create the vnode and write it out */
3580
    rvnode = malloc(SIZEOF_SMALLDISKVNODE);
3581
    if (!rvnode) {
3582
	Log("CreateRootDir: error alloc'ing memory\n");
3583
	goto error;
3584
    }
3585
3586
    rvnode->type = vFile;
3587
    rvnode->cloned = 0;
3588
    rvnode->modeBits = 0777;
3589
    rvnode->linkCount = 1;
3590
    VNDISK_SET_LEN(rvnode, length);
3591
    rvnode->uniquifier = afid->Unique;
3592
    rvnode->dataVersion = 1;
3593
    VNDISK_SET_INO(rvnode, readmeinode);
3594
    rvnode->unixModifyTime = rvnode->serverModifyTime = now;
3595
    rvnode->author = 0;
3596
    rvnode->owner = 0;
3597
    rvnode->parent = 1;
3598
    rvnode->group = 0;
3599
    rvnode->vnodeMagic = VnodeClassInfo[vSmall].magic;
3600
3601
    bytes = IH_IWRITE(vnodeInfo[vSmall].handle,
3602
                      vnodeIndexOffset(&VnodeClassInfo[vSmall], afid->Vnode),
3603
                      (char*)rvnode, SIZEOF_SMALLDISKVNODE);
3604
3605
    if (bytes != SIZEOF_SMALLDISKVNODE) {
3606
	Log("CreateReadme: IH_IWRITE failed (%d/%d)\n", (int)bytes,
3607
	    (int)SIZEOF_SMALLDISKVNODE);
3608
	goto error;
3609
    }
3610
3611
    /* update VnodeEssence for new readme vnode */
3612
    vnodeInfo[vSmall].nAllocatedVnodes++;
3613
    vep->count = 0;
3614
    vep->blockCount = nBlocks(length);
3615
    vnodeInfo[vSmall].volumeBlockCount += vep->blockCount;
3616
    vep->parent = rvnode->parent;
3617
    vep->unique = rvnode->uniquifier;
3618
    vep->modeBits = rvnode->modeBits;
3619
    vep->InodeNumber = VNDISK_GET_INO(rvnode);
3620
    vep->type = rvnode->type;
3621
    vep->author = rvnode->author;
3622
    vep->owner = rvnode->owner;
3623
    vep->group = rvnode->group;
3624
3625
    free(rvnode);
3626
    rvnode = NULL;
3627
3628
    vep->claimed = 1;
3629
    vep->changed = 0;
3630
    vep->salvaged = 1;
3631
    vep->todelete = 0;
3632
3633
    *ainode = readmeinode;
3634
3635
    return 0;
3636
3637
 error:
3638
    if (IH_DEC(alinkH, readmeinode, vid)) {
3639
	Log("CreateReadme (recovery): IH_DEC failed\n");
3640
    }
3641
3642
    if (rvnode) {
3643
	free(rvnode);
3644
	rvnode = NULL;
3645
    }
3646
3647
    return -1;
3648
}
3649
3650
/**
3651
 * create a root dir for a volume that lacks one.
3652
 *
3653
 * @param[in] volHeader vol header for the volume
3654
 * @param[in] alinkH    ihandle for disk access for this volume group
3655
 * @param[in] vid       volume id we're dealing with
3656
 * @param[out] rootdir  populated with info about the new root dir
3657
 * @param[inout] maxunique  max uniquifier for all vnodes in the volume;
3658
 *                          updated to the new max unique if we create a new
3659
 *                          vnode
3660
 *
3661
 * @return operation status
3662
 *  @retval 0  success
3663
 *  @retval -1 error
3664
 */
3665
static int
3666
CreateRootDir(VolumeDiskData *volHeader, IHandle_t *alinkH, VolumeId vid,
3667
              struct DirSummary *rootdir, Unique *maxunique)
3668
{
3669
    FileVersion dv;
3670
    int decroot = 0, decreadme = 0;
3671
    AFSFid did, readmeid;
3672
    afs_fsize_t length;
3673
    Inode rootinode;
3674
    struct VnodeDiskObject *rootvnode = NULL;
3675
    struct acl_accessList *ACL;
3676
    Inode *ip;
3677
    afs_sfsize_t bytes;
3678
    struct VnodeEssence *vep;
3679
    Inode readmeinode;
3680
    time_t now = time(NULL);
3681
3682
    if (!vnodeInfo[vLarge].vnodes && !vnodeInfo[vSmall].vnodes) {
3683
	Log("Not creating new root dir; volume appears to lack any vnodes\n");
3684
	goto error;
3685
    }
3686
3687
    if (!vnodeInfo[vLarge].vnodes) {
3688
	/* We don't have any large vnodes in the volume; allocate room
3689
	 * for one so we can recreate the root dir */
3690
	vnodeInfo[vLarge].nVnodes = 1;
3691
	vnodeInfo[vLarge].vnodes = calloc(1, sizeof(struct VnodeEssence));
3692
	vnodeInfo[vLarge].inodes = calloc(1, sizeof(Inode));
3693
3694
	assert(vnodeInfo[vLarge].vnodes);
3695
	assert(vnodeInfo[vLarge].inodes);
3696
    }
3697
3698
    vep = &vnodeInfo[vLarge].vnodes[vnodeIdToBitNumber(1)];
3699
    ip = &vnodeInfo[vLarge].inodes[vnodeIdToBitNumber(1)];
3700
    if (vep->type != vNull) {
3701
	Log("Not creating new root dir; existing vnode 1 is non-null\n");
3702
	goto error;
3703
    }
3704
3705
    if (CreateReadme(volHeader, alinkH, vid, maxunique, &readmeid, &readmeinode)) {
3706
	goto error;
3707
    }
3708
    decreadme = 1;
3709
3710
    /* set the DV to a very high number, so it is unlikely that we collide
3711
     * with a cached DV */
3712
    dv = 1 << 30;
3713
3714
    rootinode = IH_CREATE(alinkH, fileSysDevice, fileSysPath, 0, vid, 1, 1, dv);
3715
    if (!VALID_INO(rootinode)) {
3716
	Log("CreateRootDir: IH_CREATE failed\n");
3717
	goto error;
3718
    }
3719
    decroot = 1;
3720
3721
    SetSalvageDirHandle(&rootdir->dirHandle, vid, fileSysDevice, rootinode);
3722
    did.Volume = vid;
3723
    did.Vnode = 1;
3724
    did.Unique = 1;
3725
    if (MakeDir(&rootdir->dirHandle, (afs_int32*)&did, (afs_int32*)&did)) {
3726
	Log("CreateRootDir: MakeDir failed\n");
3727
	goto error;
3728
    }
3729
    if (Create(&rootdir->dirHandle, "README.ROOTDIR", &readmeid)) {
3730
	Log("CreateRootDir: Create failed\n");
3731
	goto error;
3732
    }
3733
    DFlush();
3734
    length = Length(&rootdir->dirHandle);
3735
    DZap((void *)&rootdir->dirHandle);
3736
3737
    /* create the new root dir vnode */
3738
    rootvnode = malloc(SIZEOF_LARGEDISKVNODE);
3739
    if (!rootvnode) {
3740
	Log("CreateRootDir: malloc failed\n");
3741
	goto error;
3742
    }
3743
3744
    /* only give 'rl' permissions to 'system:administrators'. We do this to
3745
     * try to catch the attention of an administrator, that they should not
3746
     * be writing to this directory or continue to use it. */
3747
    ACL = VVnodeDiskACL(rootvnode);
3748
    ACL->size = sizeof(struct acl_accessList);
3749
    ACL->version = ACL_ACLVERSION;
3750
    ACL->total = 1;
3751
    ACL->positive = 1;
3752
    ACL->negative = 0;
3753
    ACL->entries[0].id = -204; /* system:administrators */
3754
    ACL->entries[0].rights = PRSFS_READ | PRSFS_LOOKUP;
3755
3756
    rootvnode->type = vDirectory;
3757
    rootvnode->cloned = 0;
3758
    rootvnode->modeBits = 0777;
3759
    rootvnode->linkCount = 2;
3760
    VNDISK_SET_LEN(rootvnode, length);
3761
    rootvnode->uniquifier = 1;
3762
    rootvnode->dataVersion = dv;
3763
    VNDISK_SET_INO(rootvnode, rootinode);
3764
    rootvnode->unixModifyTime = rootvnode->serverModifyTime = now;
3765
    rootvnode->author = 0;
3766
    rootvnode->owner = 0;
3767
    rootvnode->parent = 0;
3768
    rootvnode->group = 0;
3769
    rootvnode->vnodeMagic = VnodeClassInfo[vLarge].magic;
3770
3771
    /* write it out to disk */
3772
    bytes = IH_IWRITE(vnodeInfo[vLarge].handle,
3773
	      vnodeIndexOffset(&VnodeClassInfo[vLarge], 1),
3774
	      (char*)rootvnode, SIZEOF_LARGEDISKVNODE);
3775
3776
    if (bytes != SIZEOF_LARGEDISKVNODE) {
3777
	/* just cast to int and don't worry about printing real 64-bit ints;
3778
	 * a large disk vnode isn't anywhere near the 32-bit limit */
3779
	Log("CreateRootDir: IH_IWRITE failed (%d/%d)\n", (int)bytes,
3780
	    (int)SIZEOF_LARGEDISKVNODE);
3781
	goto error;
3782
    }
3783
3784
    /* update VnodeEssence for the new root vnode */
3785
    vnodeInfo[vLarge].nAllocatedVnodes++;
3786
    vep->count = 0;
3787
    vep->blockCount = nBlocks(length);
3788
    vnodeInfo[vLarge].volumeBlockCount += vep->blockCount;
3789
    vep->parent = rootvnode->parent;
3790
    vep->unique = rootvnode->uniquifier;
3791
    vep->modeBits = rootvnode->modeBits;
3792
    vep->InodeNumber = VNDISK_GET_INO(rootvnode);
3793
    vep->type = rootvnode->type;
3794
    vep->author = rootvnode->author;
3795
    vep->owner = rootvnode->owner;
3796
    vep->group = rootvnode->group;
3797
3798
    free(rootvnode);
3799
    rootvnode = NULL;
3800
3801
    vep->claimed = 0;
3802
    vep->changed = 0;
3803
    vep->salvaged = 1;
3804
    vep->todelete = 0;
3805
3806
    /* update DirSummary for the new root vnode */
3807
    rootdir->vnodeNumber = 1;
3808
    rootdir->unique = 1;
3809
    rootdir->haveDot = 1;
3810
    rootdir->haveDotDot = 1;
3811
    rootdir->rwVid = vid;
3812
    rootdir->copied = 0;
3813
    rootdir->parent = 0;
3814
    rootdir->name = strdup(".");
3815
    rootdir->vname = volHeader->name;
3816
    rootdir->ds_linkH = alinkH;
3817
3818
    *ip = rootinode;
3819
3820
    return 0;
3821
3822
 error:
3823
    if (decroot && IH_DEC(alinkH, rootinode, vid)) {
3824
	Log("CreateRootDir (recovery): IH_DEC (root) failed\n");
3825
    }
3826
    if (decreadme && IH_DEC(alinkH, readmeinode, vid)) {
3827
	Log("CreateRootDir (recovery): IH_DEC (readme) failed\n");
3828
    }
3829
    if (rootvnode) {
3830
	free(rootvnode);
3831
	rootvnode = NULL;
3832
    }
3833
    return -1;
3834
}
3835
3462
int
3836
int
3463
SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH)
3837
SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH)
3464
{
3838
{
Lines 3482-3487 SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH) Link Here
3482
    VnodeId LFVnode, ThisVnode;
3856
    VnodeId LFVnode, ThisVnode;
3483
    Unique LFUnique, ThisUnique;
3857
    Unique LFUnique, ThisUnique;
3484
    char npath[128];
3858
    char npath[128];
3859
    int newrootdir = 0;
3485
3860
3486
    vid = rwIsp->volSummary->header.id;
3861
    vid = rwIsp->volSummary->header.id;
3487
    IH_INIT(h, fileSysDevice, vid, rwIsp->volSummary->header.volumeInfo);
3862
    IH_INIT(h, fileSysDevice, vid, rwIsp->volSummary->header.volumeInfo);
Lines 3511-3516 SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH) Link Here
3511
	return 0;
3886
	return 0;
3512
    }
3887
    }
3513
3888
3889
    if (!rootdirfound && (orphans == ORPH_ATTACH) && !Testing) {
3890
3891
	Log("Cannot find root directory for volume %u; attempting to create "
3892
	    "a new one\n", vid);
3893
3894
	code = CreateRootDir(&volHeader, alinkH, vid, &rootdir, &maxunique);
3895
	if (code == 0) {
3896
	    rootdirfound = 1;
3897
	    newrootdir = 1;
3898
	}
3899
    }
3900
3514
    /* Parse each vnode looking for orphaned vnodes and
3901
    /* Parse each vnode looking for orphaned vnodes and
3515
     * connect them to the tree as orphaned (if requested).
3902
     * connect them to the tree as orphaned (if requested).
3516
     */
3903
     */
Lines 3532-3539 SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH) Link Here
3532
	     */
3919
	     */
3533
	    if (class == vLarge) {	/* directory vnode */
3920
	    if (class == vLarge) {	/* directory vnode */
3534
		pv = vnodeIdToBitNumber(vep->parent);
3921
		pv = vnodeIdToBitNumber(vep->parent);
3535
		if (vnodeInfo[vLarge].vnodes[pv].unique != 0)
3922
		if (vnodeInfo[vLarge].vnodes[pv].unique != 0) {
3536
		    vnodeInfo[vLarge].vnodes[pv].count++;
3923
		    if (vep->parent == 1 && newrootdir) {
3924
			/* this vnode's parent was the volume root, and
3925
			 * we just created the volume root. So, the parent
3926
			 * dir didn't exist during JudgeEntry, so the link
3927
			 * count was not inc'd there, so don't dec it here.
3928
			 */
3929
3930
			 /* noop */
3931
3932
		    } else {
3933
			vnodeInfo[vLarge].vnodes[pv].count++;
3934
		    }
3935
		}
3537
	    }
3936
	    }
3538
3937
3539
	    if (!rootdirfound)
3938
	    if (!rootdirfound)
Lines 3731-3736 SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH) Link Here
3731
	volHeader.uniquifier = (maxunique + 1 + 2000);
4130
	volHeader.uniquifier = (maxunique + 1 + 2000);
3732
    }
4131
    }
3733
4132
4133
    if (newrootdir) {
4134
	Log("*** WARNING: Root directory recreated, but volume is fragile! "
4135
	    "Only use this salvaged volume to copy data to another volume; "
4136
	    "do not continue to use this volume (%u) as-is.\n", vid);
4137
    }
4138
3734
    /* Turn off the inUse bit; the volume's been salvaged! */
4139
    /* Turn off the inUse bit; the volume's been salvaged! */
3735
    volHeader.inUse = 0;	/* clear flag indicating inUse@last crash */
4140
    volHeader.inUse = 0;	/* clear flag indicating inUse@last crash */
3736
    volHeader.needsSalvaged = 0;	/* clear 'damaged' flag */
4141
    volHeader.needsSalvaged = 0;	/* clear 'damaged' flag */
(-)a/src/vol/volume.c (-1 / +15 lines)
Lines 979-984 attach2(Error * ec, char *path, register struct VolumeHeader * header, Link Here
979
	    V_inUse(vp) = 1;
979
	    V_inUse(vp) = 1;
980
	    V_offlineMessage(vp)[0] = '\0';
980
	    V_offlineMessage(vp)[0] = '\0';
981
	}
981
	}
982
	if (!V_inUse(vp)) {
983
	    *ec = VNOVOL;
984
	    /* mimic e.g. GetVolume errors */
985
	    if (!V_blessed(vp))
986
		Log("Volume %u offline: not blessed\n", V_id(vp));
987
	    else if (!V_inService(vp))
988
		Log("Volume %u offline: not in service\n", V_id(vp));
989
	    else {
990
		Log("Volume %u offline: needs salvage\n", V_id(vp));
991
		*ec = VOFFLINE;
992
	    }
993
	    VPutVolume_r(vp);
994
	    vp = NULL;
995
	}
982
    }
996
    }
983
997
984
    return vp;
998
    return vp;
Lines 1581-1587 GetBitmap(Error * ec, Volume * vp, VnodeClass class) Link Here
1581
{
1595
{
1582
    StreamHandle_t *file;
1596
    StreamHandle_t *file;
1583
    int nVnodes;
1597
    int nVnodes;
1584
    int size;
1598
    afs_sfsize_t size;
1585
    struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
1599
    struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
1586
    struct vnodeIndex *vip = &vp->vnodeIndex[class];
1600
    struct vnodeIndex *vip = &vp->vnodeIndex[class];
1587
    struct VnodeDiskObject *vnode;
1601
    struct VnodeDiskObject *vnode;
(-)a/src/volser/dumpstuff.c (-5 / +6 lines)
Lines 45-50 Link Here
45
#include "dump.h"
45
#include "dump.h"
46
#include <afs/fssync.h>
46
#include <afs/fssync.h>
47
#include <afs/acl.h>
47
#include <afs/acl.h>
48
#include <afs/com_err.h>
48
#include "volser.h"
49
#include "volser.h"
49
#include "volint.h"
50
#include "volint.h"
50
51
Lines 1011-1019 DumpVnodeIndex(register struct iod *iodp, Volume * vp, VnodeClass class, Link Here
1011
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
1012
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
1012
    StreamHandle_t *file;
1013
    StreamHandle_t *file;
1013
    FdHandle_t *fdP;
1014
    FdHandle_t *fdP;
1014
    int size;
1015
    afs_sfsize_t size, nVnodes;
1015
    int flag;
1016
    int flag;
1016
    register int vnodeIndex, nVnodes;
1017
    register int vnodeIndex;
1017
1018
1018
    fdP = IH_OPEN(vp->vnodeIndex[class].handle);
1019
    fdP = IH_OPEN(vp->vnodeIndex[class].handle);
1019
    assert(fdP != NULL);
1020
    assert(fdP != NULL);
Lines 1137-1143 ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep, Link Here
1137
    int i, nVnodes, offset, code, index = 0;
1138
    int i, nVnodes, offset, code, index = 0;
1138
    afs_int32 *Buf;
1139
    afs_int32 *Buf;
1139
    int cnt = 0;
1140
    int cnt = 0;
1140
    int size;
1141
    afs_sfsize_t size;
1141
    StreamHandle_t *afile;
1142
    StreamHandle_t *afile;
1142
    FdHandle_t *fdP;
1143
    FdHandle_t *fdP;
1143
    struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
1144
    struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
Lines 1873-1881 SizeDumpVnodeIndex(register struct iod *iodp, Volume * vp, VnodeClass class, Link Here
1873
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
1874
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
1874
    StreamHandle_t *file;
1875
    StreamHandle_t *file;
1875
    FdHandle_t *fdP;
1876
    FdHandle_t *fdP;
1876
    int size;
1877
    afs_sfsize_t size, nVnodes;
1877
    int flag;
1878
    int flag;
1878
    register int vnodeIndex, nVnodes;
1879
    register int vnodeIndex;
1879
1880
1880
    fdP = IH_OPEN(vp->vnodeIndex[class].handle);
1881
    fdP = IH_OPEN(vp->vnodeIndex[class].handle);
1881
    assert(fdP != NULL);
1882
    assert(fdP != NULL);
(-)a/src/volser/vol-dump.c (-1 / +1 lines)
Lines 775-781 DumpVnodeIndex(int dumpfd, Volume * vp, VnodeClass class, afs_int32 fromtime, Link Here
775
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
775
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
776
    StreamHandle_t *file;
776
    StreamHandle_t *file;
777
    FdHandle_t *fdP;
777
    FdHandle_t *fdP;
778
    int size;
778
    afs_sfsize_t size;
779
    int flag;
779
    int flag;
780
    int offset = 0;
780
    int offset = 0;
781
    register int vnodeIndex, nVnodes = 0;
781
    register int vnodeIndex, nVnodes = 0;
(-)a/src/volser/volprocs.c (-7 / +14 lines)
Lines 95-101 VolSetIdsTypes(), VolSetDate(), VolSetFlags(); Link Here
95
95
96
/* this call unlocks all of the partition locks we've set */
96
/* this call unlocks all of the partition locks we've set */
97
int 
97
int 
98
VPFullUnlock()
98
VPFullUnlock_r(void)
99
{
99
{
100
    register struct DiskPartition64 *tp;
100
    register struct DiskPartition64 *tp;
101
    for (tp = DiskPartitionList; tp; tp = tp->next) {
101
    for (tp = DiskPartitionList; tp; tp = tp->next) {
Lines 107-112 VPFullUnlock() Link Here
107
    return 0;
107
    return 0;
108
}
108
}
109
109
110
int
111
VPFullUnlock(void)
112
{
113
    int code;
114
    VOL_LOCK;
115
    code = VPFullUnlock_r();
116
    VOL_UNLOCK;
117
    return code;
118
}
119
110
/* get partition id from a name */
120
/* get partition id from a name */
111
afs_int32
121
afs_int32
112
PartitionID(char *aname)
122
PartitionID(char *aname)
Lines 2642-2648 VolMonitor(struct rx_call *acid, transDebugEntries *transInfo) Link Here
2642
{
2652
{
2643
    transDebugInfo *pntr;
2653
    transDebugInfo *pntr;
2644
    afs_int32 allocSize = 50;
2654
    afs_int32 allocSize = 50;
2645
    struct volser_trans *tt, *allTrans;
2655
    struct volser_trans *tt, *nt, *allTrans;
2646
2656
2647
    transInfo->transDebugEntries_val =
2657
    transInfo->transDebugEntries_val =
2648
	(transDebugInfo *) malloc(allocSize * sizeof(transDebugInfo));
2658
	(transDebugInfo *) malloc(allocSize * sizeof(transDebugInfo));
Lines 2655-2663 VolMonitor(struct rx_call *acid, transDebugEntries *transInfo) Link Here
2655
    allTrans = TransList();
2665
    allTrans = TransList();
2656
    if (allTrans == (struct volser_trans *)0)
2666
    if (allTrans == (struct volser_trans *)0)
2657
	goto done;		/*no active transactions */
2667
	goto done;		/*no active transactions */
2658
    for (tt = allTrans; tt; tt = tt->next) {	/*copy relevant info into pntr */
2668
    for (tt = allTrans; tt; tt = nt) {	/*copy relevant info into pntr */
2659
        THOLD(tt);  /* do not delete tt while copying info */
2669
	nt = tt->next;
2660
        VTRANS_UNLOCK;
2661
        VTRANS_OBJ_LOCK(tt);
2670
        VTRANS_OBJ_LOCK(tt);
2662
	pntr->tid = tt->tid;
2671
	pntr->tid = tt->tid;
2663
	pntr->time = tt->time;
2672
	pntr->time = tt->time;
Lines 2694-2701 VolMonitor(struct rx_call *acid, transDebugEntries *transInfo) Link Here
2694
	    /*set pntr to right position */
2703
	    /*set pntr to right position */
2695
	}
2704
	}
2696
2705
2697
        TRELE(tt);
2698
        VTRANS_LOCK;
2699
    }
2706
    }
2700
done:
2707
done:
2701
    VTRANS_UNLOCK;
2708
    VTRANS_UNLOCK;
(-)a/src/volser/vsprocs.c (-4 / +9 lines)
Lines 3688-3695 UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver, Link Here
3688
3688
3689
	    if (fromdate == 0)
3689
	    if (fromdate == 0)
3690
		fprintf(STDOUT, " (full release)");
3690
		fprintf(STDOUT, " (full release)");
3691
	    else
3691
	    else {
3692
		fprintf(STDOUT, " (as of %.24s)", ctime((time_t *)&fromdate));
3692
	        tmv = fromdate;
3693
		fprintf(STDOUT, " (as of %.24s)", ctime(&tmv));
3694
	    }
3693
	    fprintf(STDOUT, ".\n");
3695
	    fprintf(STDOUT, ".\n");
3694
	    fflush(STDOUT);
3696
	    fflush(STDOUT);
3695
	}
3697
	}
Lines 3943-3948 UV_DumpVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart, Link Here
3943
    struct rx_call *fromcall = (struct rx_call *)0;
3945
    struct rx_call *fromcall = (struct rx_call *)0;
3944
    afs_int32 fromtid = 0, rxError = 0, rcode = 0;
3946
    afs_int32 fromtid = 0, rxError = 0, rcode = 0;
3945
    afs_int32 code, error = 0, retry = 0;
3947
    afs_int32 code, error = 0, retry = 0;
3948
    time_t tmv = fromdate;
3946
3949
3947
    if (setjmp(env))
3950
    if (setjmp(env))
3948
	ERROR_EXIT(EPIPE);
3951
	ERROR_EXIT(EPIPE);
Lines 3955-3961 UV_DumpVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart, Link Here
3955
	VEPRINT("Full Dump ...\n");
3958
	VEPRINT("Full Dump ...\n");
3956
    } else {
3959
    } else {
3957
	VEPRINT1("Incremental Dump (as of %.24s)...\n",
3960
	VEPRINT1("Incremental Dump (as of %.24s)...\n",
3958
		ctime((time_t *) & fromdate));
3961
		ctime(&tmv));
3959
    }
3962
    }
3960
3963
3961
    /* get connections to the servers */
3964
    /* get connections to the servers */
Lines 4033-4038 UV_DumpClonedVolume(afs_int32 afromvol, afs_int32 afromserver, Link Here
4033
    afs_int32 code = 0, vcode = 0, error = 0;
4036
    afs_int32 code = 0, vcode = 0, error = 0;
4034
    afs_int32 clonevol = 0;
4037
    afs_int32 clonevol = 0;
4035
    char vname[64];
4038
    char vname[64];
4039
    time_t tmv = fromdate;
4036
4040
4037
    if (setjmp(env))
4041
    if (setjmp(env))
4038
	ERROR_EXIT(EPIPE);
4042
	ERROR_EXIT(EPIPE);
Lines 4045-4051 UV_DumpClonedVolume(afs_int32 afromvol, afs_int32 afromserver, Link Here
4045
	VEPRINT("Full Dump ...\n");
4049
	VEPRINT("Full Dump ...\n");
4046
    } else {
4050
    } else {
4047
	VEPRINT1("Incremental Dump (as of %.24s)...\n",
4051
	VEPRINT1("Incremental Dump (as of %.24s)...\n",
4048
		ctime((time_t *) & fromdate));
4052
		ctime(&tmv));
4049
    }
4053
    }
4050
4054
4051
    /* get connections to the servers */
4055
    /* get connections to the servers */
Lines 7122-7127 UV_GetSize(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart, Link Here
7122
    struct rx_connection *aconn = (struct rx_connection *)0;
7126
    struct rx_connection *aconn = (struct rx_connection *)0;
7123
    afs_int32 tid = 0, rcode = 0;
7127
    afs_int32 tid = 0, rcode = 0;
7124
    afs_int32 code, error = 0;
7128
    afs_int32 code, error = 0;
7129
    time_t tmv = fromdate;
7125
7130
7126
7131
7127
    /* get connections to the servers */
7132
    /* get connections to the servers */
(-)a/src/xstat/xstat_cm_test.c (-5 / +8 lines)
Lines 124-136 PrintCallInfo() Link Here
124
    int numInt32s;		/*# int32words returned */
124
    int numInt32s;		/*# int32words returned */
125
    afs_int32 *currInt32;	/*Ptr to current afs_int32 value */
125
    afs_int32 *currInt32;	/*Ptr to current afs_int32 value */
126
    char *printableTime;	/*Ptr to printable time string */
126
    char *printableTime;	/*Ptr to printable time string */
127
127
    time_t probeTime = xstat_cm_Results.probeTime;
128
    /*
128
    /*
129
     * Just print out the results of the particular probe.
129
     * Just print out the results of the particular probe.
130
     */
130
     */
131
    numInt32s = xstat_cm_Results.data.AFSCB_CollData_len;
131
    numInt32s = xstat_cm_Results.data.AFSCB_CollData_len;
132
    currInt32 = (afs_int32 *) (xstat_cm_Results.data.AFSCB_CollData_val);
132
    currInt32 = (afs_int32 *) (xstat_cm_Results.data.AFSCB_CollData_val);
133
    printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
133
    printableTime = ctime(&probeTime);
134
    printableTime[strlen(printableTime) - 1] = '\0';
134
    printableTime[strlen(printableTime) - 1] = '\0';
135
135
136
    printf
136
    printf
Lines 156-163 print_cmCallStats() Link Here
156
    static char rn[] = "print_cmCallStats";	/*Routine name */
156
    static char rn[] = "print_cmCallStats";	/*Routine name */
157
    char *printableTime;	/*Ptr to printable time string */
157
    char *printableTime;	/*Ptr to printable time string */
158
    struct afs_CMStats *cmp;
158
    struct afs_CMStats *cmp;
159
    time_t probeTime = xstat_cm_Results.probeTime;
159
160
160
    printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
161
    printableTime = ctime(&probeTime);
161
    printableTime[strlen(printableTime) - 1] = '\0';
162
    printableTime[strlen(printableTime) - 1] = '\0';
162
163
163
    printf
164
    printf
Lines 794-799 PrintPerfInfo() Link Here
794
    afs_int32 numInt32s;	/*# int32words received */
795
    afs_int32 numInt32s;	/*# int32words received */
795
    struct afs_stats_CMPerf *perfP;	/*Ptr to performance stats */
796
    struct afs_stats_CMPerf *perfP;	/*Ptr to performance stats */
796
    char *printableTime;	/*Ptr to printable time string */
797
    char *printableTime;	/*Ptr to printable time string */
798
    time_t probeTime = xstat_cm_Results.probeTime;
797
799
798
    numInt32s = xstat_cm_Results.data.AFSCB_CollData_len;
800
    numInt32s = xstat_cm_Results.data.AFSCB_CollData_len;
799
    if (numInt32s != perfInt32s) {
801
    if (numInt32s != perfInt32s) {
Lines 803-809 PrintPerfInfo() Link Here
803
	return;
805
	return;
804
    }
806
    }
805
807
806
    printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
808
    printableTime = ctime(&probeTime);
807
    printableTime[strlen(printableTime) - 1] = '\0';
809
    printableTime[strlen(printableTime) - 1] = '\0';
808
    perfP = (struct afs_stats_CMPerf *)
810
    perfP = (struct afs_stats_CMPerf *)
809
	(xstat_cm_Results.data.AFSCB_CollData_val);
811
	(xstat_cm_Results.data.AFSCB_CollData_val);
Lines 1025-1030 PrintFullPerfInfo() Link Here
1025
    struct afs_stats_CMFullPerf *fullP;	/*Ptr to full perf info */
1027
    struct afs_stats_CMFullPerf *fullP;	/*Ptr to full perf info */
1026
1028
1027
    char *printableTime;	/*Ptr to printable time string */
1029
    char *printableTime;	/*Ptr to printable time string */
1030
    time_t probeTime = xstat_cm_Results.probeTime;
1028
1031
1029
    numInt32s = xstat_cm_Results.data.AFSCB_CollData_len;
1032
    numInt32s = xstat_cm_Results.data.AFSCB_CollData_len;
1030
    if (numInt32s != fullPerfInt32s) {
1033
    if (numInt32s != fullPerfInt32s) {
Lines 1034-1040 PrintFullPerfInfo() Link Here
1034
	return;
1037
	return;
1035
    }
1038
    }
1036
1039
1037
    printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
1040
    printableTime = ctime(&probeTime);
1038
    printableTime[strlen(printableTime) - 1] = '\0';
1041
    printableTime[strlen(printableTime) - 1] = '\0';
1039
    fullP = (struct afs_stats_CMFullPerf *)
1042
    fullP = (struct afs_stats_CMFullPerf *)
1040
	(xstat_cm_Results.data.AFSCB_CollData_val);
1043
	(xstat_cm_Results.data.AFSCB_CollData_val);
(-)a/src/xstat/xstat_fs_test.c (-3 / +6 lines)
Lines 113-125 PrintCallInfo() Link Here
113
    int numInt32s;		/*# int32words returned */
113
    int numInt32s;		/*# int32words returned */
114
    afs_int32 *currInt32;	/*Ptr to current afs_int32 value */
114
    afs_int32 *currInt32;	/*Ptr to current afs_int32 value */
115
    char *printableTime;	/*Ptr to printable time string */
115
    char *printableTime;	/*Ptr to printable time string */
116
    time_t probeTime = xstat_fs_Results.probeTime;
116
117
117
    /*
118
    /*
118
     * Just print out the results of the particular probe.
119
     * Just print out the results of the particular probe.
119
     */
120
     */
120
    numInt32s = xstat_fs_Results.data.AFS_CollData_len;
121
    numInt32s = xstat_fs_Results.data.AFS_CollData_len;
121
    currInt32 = (afs_int32 *) (xstat_fs_Results.data.AFS_CollData_val);
122
    currInt32 = (afs_int32 *) (xstat_fs_Results.data.AFS_CollData_val);
122
    printableTime = ctime((time_t *) & (xstat_fs_Results.probeTime));
123
    printableTime = ctime(&probeTime);
123
    printableTime[strlen(printableTime) - 1] = '\0';
124
    printableTime[strlen(printableTime) - 1] = '\0';
124
125
125
    printf("AFS_XSTATSCOLL_CALL_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
126
    printf("AFS_XSTATSCOLL_CALL_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
Lines 414-419 PrintFullPerfInfo() Link Here
414
    struct fs_stats_FullPerfStats *fullPerfP;	/*Ptr to full perf stats */
415
    struct fs_stats_FullPerfStats *fullPerfP;	/*Ptr to full perf stats */
415
    char *printableTime;	/*Ptr to printable time
416
    char *printableTime;	/*Ptr to printable time
416
				 * string */
417
				 * string */
418
    time_t probeTime = xstat_fs_Results.probeTime;
417
419
418
    numInt32s = xstat_fs_Results.data.AFS_CollData_len;
420
    numInt32s = xstat_fs_Results.data.AFS_CollData_len;
419
    if (numInt32s != fullPerfInt32s) {
421
    if (numInt32s != fullPerfInt32s) {
Lines 422-428 PrintFullPerfInfo() Link Here
422
	return;
424
	return;
423
    }
425
    }
424
426
425
    printableTime = ctime((time_t *) & (xstat_fs_Results.probeTime));
427
    printableTime = ctime(&probeTime);
426
    printableTime[strlen(printableTime) - 1] = '\0';
428
    printableTime[strlen(printableTime) - 1] = '\0';
427
    fullPerfP = (struct fs_stats_FullPerfStats *)
429
    fullPerfP = (struct fs_stats_FullPerfStats *)
428
	(xstat_fs_Results.data.AFS_CollData_val);
430
	(xstat_fs_Results.data.AFS_CollData_val);
Lines 465-470 PrintPerfInfo() Link Here
465
    afs_int32 numInt32s;	/*# int32words received */
467
    afs_int32 numInt32s;	/*# int32words received */
466
    struct afs_PerfStats *perfP;	/*Ptr to performance stats */
468
    struct afs_PerfStats *perfP;	/*Ptr to performance stats */
467
    char *printableTime;	/*Ptr to printable time string */
469
    char *printableTime;	/*Ptr to printable time string */
470
    time_t probeTime = xstat_fs_Results.probeTime;
468
471
469
    numInt32s = xstat_fs_Results.data.AFS_CollData_len;
472
    numInt32s = xstat_fs_Results.data.AFS_CollData_len;
470
    if (numInt32s != perfInt32s) {
473
    if (numInt32s != perfInt32s) {
Lines 473-479 PrintPerfInfo() Link Here
473
	return;
476
	return;
474
    }
477
    }
475
478
476
    printableTime = ctime((time_t *) & (xstat_fs_Results.probeTime));
479
    printableTime = ctime(&probeTime);
477
    printableTime[strlen(printableTime) - 1] = '\0';
480
    printableTime[strlen(printableTime) - 1] = '\0';
478
    perfP = (struct afs_PerfStats *)
481
    perfP = (struct afs_PerfStats *)
479
	(xstat_fs_Results.data.AFS_CollData_val);
482
	(xstat_fs_Results.data.AFS_CollData_val);

Return to bug 342101