afs_calc_inum(avc->f.fid.Cell,
avc->f.fid.Fid.Volume,
avc->f.fid.Fid.Vnode);
+ attrs->va_nodeid &= 0x7fffffff; /* Saber C hates negative inode #s! */
attrs->va_nlink = fakedir ? 100 : avc->f.m.LinkCount;
attrs->va_size = fakedir ? 4096 : avc->f.m.Length;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
/* afs_util.c */
extern afs_int32 afs_strtoi_r(const char *str, char **endptr, afs_uint32 *ret);
-extern ino_t afs_calc_inum(afs_int32 cell, afs_int32 volume, afs_int32 vnode);
+extern afs_int32 afs_calc_inum(afs_int32 cell, afs_int32 volume,
+ afs_int32 vnode);
#ifndef afs_cv2string
extern char *afs_cv2string(char *ttp, afs_uint32 aval);
#endif
}
#ifdef AFS_LINUX20_ENV
-static_inline ino_t
+static_inline afs_int32
afs_calc_inum_md5(afs_int32 cell, afs_int32 volume, afs_int32 vnode)
{
- ino_t ino = 0;
- afs_int32 vno = vnode;
+ afs_int32 ino = 0, vno = vnode;
char digest[16];
struct md5 ct;
memcpy(&ino, &digest[offset], sizeof(ino));
ino ^= (ino ^ vno) & 1;
-
- /* Clear MSB to ensure a positive inode number */
- ino &= ~(1ULL << (sizeof(ino) * 8 - 1));
+ ino &= 0x7fffffff; /* Assumes 32 bit ino_t ..... */
}
}
return ino;
# define afs_calc_inum_md5(cell, volume, vnode) 0
#endif
-ino_t
+afs_int32
afs_calc_inum(afs_int32 cell, afs_int32 volume, afs_int32 vnode)
{
- ino_t ino;
+ afs_int32 ino;
ino = afs_calc_inum_md5(cell, volume, vnode);
if (ino == 0 || ino == 1) {
- /* If we have 32-bit inodes, just shift the volume id 16 bits; but
- * if we have 64-bit inodes, we can dedicate 32 bits for the volid,
- * and 32 bits for the vnode. */
- ino = ((ino_t)volume << (sizeof(ino)*4)) + vnode;
+ ino = (volume << 16) + vnode;
}
- /* Clear MSB to ensure a positive inode number */
- ino &= ~(1ULL << (sizeof(ino) * 8 - 1));
+ ino &= 0x7fffffff; /* Assumes 32 bit ino_t ..... */
return ino;
}