Check-in [ed7fabb181]
Overview
Comment:Updated to give each file owned by a different UID their own inode so the VFS will (maybe) think they are different files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ed7fabb181992dc5a8436e09e48b3dad526f3815
User & Date: rkeene on 2015-05-05 21:58:44
Other Links: manifest | tags
Context
2015-05-12
13:30
Updated to be more subtle with differing inodes, only differ them if the files are different check-in: 3021e03379 user: rkeene tags: trunk
2015-05-05
21:58
Updated to give each file owned by a different UID their own inode so the VFS will (maybe) think they are different files check-in: ed7fabb181 user: rkeene tags: trunk
2015-03-20
15:20
Post-release version increment check-in: f2103b6461 user: rkeene tags: trunk
Changes

Modified appfsd.c from [6a6fdd4f92] to [59919e0d2e].

625
626
627
628
629
630
631
632

633
634
635
636
637
638
639
640
641
642
643
644
645
646


647
648
649
650
651
652
653
625
626
627
628
629
630
631

632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655







-
+














+
+







 * 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) {
static unsigned long long appfs_get_path_inode(const char *path, int uid) {
	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
	}

	retval += uid;

	return(retval);
}

/*
 * Cache Get Path Info lookups for speed
 */
662
663
664
665
666
667
668
669

670
671
672
673
674
675
676
664
665
666
667
668
669
670

671
672
673
674
675
676
677
678







-
+







	if (pthread_ret != 0) {
		APPFS_DEBUG("Unable to lock path_info cache mutex !");

		return(-1);
	}

	if (appfs_path_info_cache != NULL) {
		hash_idx = (appfs_get_path_inode(path) + uid) % appfs_path_info_cache_size;
		hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size;

		if (appfs_path_info_cache[hash_idx]._cache_path != NULL) {
			if (strcmp(appfs_path_info_cache[hash_idx]._cache_path, path) == 0 && appfs_path_info_cache[hash_idx]._cache_uid == uid) {
				retval = 0;

				memcpy(pathinfo, &appfs_path_info_cache[hash_idx], sizeof(*pathinfo));
				pathinfo->_cache_path = NULL;
705
706
707
708
709
710
711
712

713
714
715
716
717
718
719
707
708
709
710
711
712
713

714
715
716
717
718
719
720
721







-
+







		return;
	}

	if (appfs_path_info_cache == NULL) {
		appfs_path_info_cache = calloc(appfs_path_info_cache_size, sizeof(*appfs_path_info_cache));
	}

	hash_idx = (appfs_get_path_inode(path) + uid) % appfs_path_info_cache_size;
	hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size;

	if (appfs_path_info_cache[hash_idx]._cache_path != NULL) {
		free(appfs_path_info_cache[hash_idx]._cache_path);
	}

	memcpy(&appfs_path_info_cache[hash_idx], pathinfo, sizeof(*pathinfo));

738
739
740
741
742
743
744
745

746
747
748
749
750
751
752
740
741
742
743
744
745
746

747
748
749
750
751
752
753
754







-
+







	if (pthread_ret != 0) {
		APPFS_DEBUG("Unable to lock path_info cache mutex !");

		return;
	}

	if (appfs_path_info_cache != NULL) {
		hash_idx = (appfs_get_path_inode(path) + uid) % appfs_path_info_cache_size;
		hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size;

		if (appfs_path_info_cache[hash_idx]._cache_path != NULL) {
			free(appfs_path_info_cache[hash_idx]._cache_path);

			appfs_path_info_cache[hash_idx]._cache_path = NULL;
		}
	}
909
910
911
912
913
914
915
916

917
918
919
920
921
922
923
911
912
913
914
915
916
917

918
919
920
921
922
923
924
925







-
+








		appfs_call_libtcl(Tcl_Release(interp);)

		return(-EIO);
	}

	pathinfo->packaged = 0;
	pathinfo->inode = appfs_get_path_inode(path);
	pathinfo->inode = appfs_get_path_inode(path, fsuid);

	appfs_call_libtcl(
		attr_value_str = Tcl_GetString(attr_value);

		switch (attr_value_str[0]) {
			case 'd': /* directory */
				pathinfo->type = APPFS_PATHTYPE_DIRECTORY;