496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
* 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 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;
|
|
<
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
|
* 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 += *p;
retval <<= 6;
}
retval += 10;
retval %= 4294967286ULL;
retval += 10;
|