596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
|
return(retval);
}
/*
* Generate an inode for a given path. The inode should be computed in such
* a way that it is unlikely to be duplicated and remains the same for a given
* file
*/
#if UINT_MAX < 4294967295
#error Integer size is too small
#endif
static unsigned long long appfs_get_path_inode(const char *path) {
int retval;
const char *p;
retval = 10;
for (p = path; *p; p++) {
retval %= 4290960290ULL;
retval += *p;
retval <<= 6;
}
retval += 10;
retval %= 4294967286ULL;
retval += 10;
return(retval);
}
/*
* Cache Get Path Info lookups for speed
*/
|
>
>
|
|
|
|
<
|
>
|
>
>
>
>
<
<
<
<
|
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
|
return(retval);
}
/*
* Generate an inode for a given path. The inode should be computed in such
* a way that it is unlikely to be duplicated and remains the same for a given
* file
*
* Current implementation is an FNV-1a 32-bit
*/
#if UINT_MAX < 4294967295
#error Integer size is too small
#endif
static unsigned long long appfs_get_path_inode(const char *path) {
unsigned int retval;
const unsigned char *p;
retval = 2166136261; /* FNV-1a 32-bit offset_basis */
for (p = (unsigned char *) path; *p; p++) {
retval ^= (int) *p;
#if 0
retval *= 16777619; /* FNV-1a 32-bit prime */
#else
/* GCC Optimized replacement */
retval += (retval << 1) + (retval << 4) + (retval << 7) + (retval << 8) + (retval << 24);
#endif
}
return(retval);
}
/*
* Cache Get Path Info lookups for speed
*/
|