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

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

   625    625    * file
   626    626    *
   627    627    * Current implementation is an FNV-1a 32-bit
   628    628    */
   629    629   #if UINT_MAX < 4294967295
   630    630   #error Integer size is too small 
   631    631   #endif
   632         -static unsigned long long appfs_get_path_inode(const char *path) {
          632  +static unsigned long long appfs_get_path_inode(const char *path, int uid) {
   633    633   	unsigned int retval;
   634    634   	const unsigned char *p;
   635    635   
   636    636   	retval = 2166136261; /* FNV-1a 32-bit offset_basis */
   637    637   
   638    638   	for (p = (unsigned char *) path; *p; p++) {
   639    639   		retval ^= (int) *p;
................................................................................
   640    640   #if 0
   641    641   		retval *= 16777619; /* FNV-1a 32-bit prime */
   642    642   #else
   643    643   		/* GCC Optimized replacement */
   644    644   		retval += (retval << 1) + (retval << 4) + (retval << 7) + (retval << 8) + (retval << 24);
   645    645   #endif
   646    646   	}
          647  +
          648  +	retval += uid;
   647    649   
   648    650   	return(retval);
   649    651   }
   650    652   
   651    653   /*
   652    654    * Cache Get Path Info lookups for speed
   653    655    */
................................................................................
   662    664   	if (pthread_ret != 0) {
   663    665   		APPFS_DEBUG("Unable to lock path_info cache mutex !");
   664    666   
   665    667   		return(-1);
   666    668   	}
   667    669   
   668    670   	if (appfs_path_info_cache != NULL) {
   669         -		hash_idx = (appfs_get_path_inode(path) + uid) % appfs_path_info_cache_size;
          671  +		hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size;
   670    672   
   671    673   		if (appfs_path_info_cache[hash_idx]._cache_path != NULL) {
   672    674   			if (strcmp(appfs_path_info_cache[hash_idx]._cache_path, path) == 0 && appfs_path_info_cache[hash_idx]._cache_uid == uid) {
   673    675   				retval = 0;
   674    676   
   675    677   				memcpy(pathinfo, &appfs_path_info_cache[hash_idx], sizeof(*pathinfo));
   676    678   				pathinfo->_cache_path = NULL;
................................................................................
   705    707   		return;
   706    708   	}
   707    709   
   708    710   	if (appfs_path_info_cache == NULL) {
   709    711   		appfs_path_info_cache = calloc(appfs_path_info_cache_size, sizeof(*appfs_path_info_cache));
   710    712   	}
   711    713   
   712         -	hash_idx = (appfs_get_path_inode(path) + uid) % appfs_path_info_cache_size;
          714  +	hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size;
   713    715   
   714    716   	if (appfs_path_info_cache[hash_idx]._cache_path != NULL) {
   715    717   		free(appfs_path_info_cache[hash_idx]._cache_path);
   716    718   	}
   717    719   
   718    720   	memcpy(&appfs_path_info_cache[hash_idx], pathinfo, sizeof(*pathinfo));
   719    721   
................................................................................
   738    740   	if (pthread_ret != 0) {
   739    741   		APPFS_DEBUG("Unable to lock path_info cache mutex !");
   740    742   
   741    743   		return;
   742    744   	}
   743    745   
   744    746   	if (appfs_path_info_cache != NULL) {
   745         -		hash_idx = (appfs_get_path_inode(path) + uid) % appfs_path_info_cache_size;
          747  +		hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size;
   746    748   
   747    749   		if (appfs_path_info_cache[hash_idx]._cache_path != NULL) {
   748    750   			free(appfs_path_info_cache[hash_idx]._cache_path);
   749    751   
   750    752   			appfs_path_info_cache[hash_idx]._cache_path = NULL;
   751    753   		}
   752    754   	}
................................................................................
   909    911   
   910    912   		appfs_call_libtcl(Tcl_Release(interp);)
   911    913   
   912    914   		return(-EIO);
   913    915   	}
   914    916   
   915    917   	pathinfo->packaged = 0;
   916         -	pathinfo->inode = appfs_get_path_inode(path);
          918  +	pathinfo->inode = appfs_get_path_inode(path, fsuid);
   917    919   
   918    920   	appfs_call_libtcl(
   919    921   		attr_value_str = Tcl_GetString(attr_value);
   920    922   
   921    923   		switch (attr_value_str[0]) {
   922    924   			case 'd': /* directory */
   923    925   				pathinfo->type = APPFS_PATHTYPE_DIRECTORY;