2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
17 #include "listVicepx.h"
19 DirEnt
*hash
[MAX_HASH_SIZE
];
20 static char *stack
[MAX_STACK_SIZE
];
22 static char fileName
[2048];
24 /* hashes a number in the range 1.. MAX_HASH_SIZE */
28 return (num
% MAX_HASH_SIZE
);
32 /* insert entry in hash table */
37 h
= mountHash(dir
->vnode
);
39 /* insert in hash table */
49 ptr
= hash
[mountHash(vnode
)];
51 if (ptr
->vnode
== vnode
)
64 for (i
= 0; i
< dir
->numEntries
; i
++)
65 if (dir
->vnodeName
[i
].vnode
== node
)
66 return dir
->vnodeName
[i
].name
;
71 /* this shud be called on a vnode for a file only */
73 getFileName(dir
, unique
)
77 /* go down the linked list */
79 for (i
= 0; i
< dir
->numEntries
; i
++)
80 if (dir
->vnodeName
[i
].vunique
== unique
)
81 return dir
->vnodeName
[i
].name
;
89 for (i
= 0; i
< MAX_HASH_SIZE
; i
++) {
90 DirEnt
*ptr
= hash
[i
];
93 printf("Vnode: %d Parent Vnode : %d \n", ptr
->vnode
,
96 for (j
= 0; j
< ptr
->numEntries
; j
++)
97 printf("\t %s %d %d\n", ptr
->vnodeName
[j
].name
,
98 ptr
->vnodeName
[j
].vnode
, ptr
->vnodeName
[j
].vunique
);
107 assert(stackSize
< MAX_STACK_SIZE
);
108 assert(stack
[stackSize
] = (char *)malloc(strlen(name
) + 1));
109 strcpy(stack
[stackSize
], name
);
117 return 0; /* stack empty */
118 return stack
[--stackSize
];
126 while (name
= popStack()) {
127 strcat(fileName
, "/");
128 strcat(fileName
, name
);