Check-in [97e72202db]
Overview
Comment:Updated to indicate only that packaged files are writable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:97e72202db38a1a483bb34a06b96de16cf5f8865
User & Date: rkeene on 2014-11-06 02:49:28
Other Links: manifest | tags
Context
2014-11-06
03:05
Updated to use package name instead of hash for looking up extra files check-in: 98449bcf3e user: rkeene tags: trunk
02:49
Updated to indicate only that packaged files are writable check-in: 97e72202db user: rkeene tags: trunk
2014-11-05
21:41
Fixed cleanup issue which was causing excessive lookups check-in: cc5a68a6de user: rkeene tags: trunk
Changes

Modified appfsd.c from [72840611b5] to [430cff4a7a].

52
53
54
55
56
57
58

59
60
61
62
63
64
65
...
742
743
744
745
746
747
748

749
750
751
752

753
754
755
756
757
758
759



760
761
762
763
764
765
766
...
874
875
876
877
878
879
880

881
882
883
884
885
886
887
...
993
994
995
996
997
998
999

1000
1001

1002
1003
1004
1005
1006
1007
1008
	char name[256];
};

struct appfs_pathinfo {
	appfs_pathtype_t type;
	time_t time;
	char hostname[256];

	unsigned long long inode;
	union {
		struct {
			int childcount;
		} dir;
		struct {
			int executable;
................................................................................
	char *hostname, *packagename, *os_cpuArch, *os, *cpuArch, *version;
	char *path, *path_s;
	char *package_hash;
	char *sql;
	int files_count;
	int fileinfo_ret, retval;


	if (children) {
		*children = NULL;
	}


	if (_path == NULL) {
		return(-ENOENT);
	}

	if (_path[0] != '/') {
		return(-ENOENT);
	}




	if (_path[1] == '\0') {
		/* Request for the root directory */
		pathinfo->hostname[0] = '\0';
		pathinfo->inode = 1;

		sql = sqlite3_mprintf("SELECT DISTINCT hostname FROM packages;");
................................................................................
		path = "";
	} else {
		*path = '\0';
		path++;
	}

	/* Request for a file in a specific package */

	APPFS_DEBUG("Requesting information for hostname = %s, package = %s, os = %s, cpuArch = %s, version = %s, path = %s", 
		hostname, packagename, os, cpuArch, version, path
	);

	package_hash = appfs_lookup_package_hash(hostname, packagename, os, cpuArch, version);
	if (package_hash == NULL) {
		free(path_s);
................................................................................
			break;
		case APPFS_PATHTYPE_INVALID:
			res = -EIO;

			break;
	}


	if (globalThread.options.writable) {
		stbuf->st_mode |= 0222;

	}

	return res;
}

static int appfs_fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) {
	struct appfs_pathinfo pathinfo;







>







 







>




>







>
>
>







 







>







 







>
|
|
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
...
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
....
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
	char name[256];
};

struct appfs_pathinfo {
	appfs_pathtype_t type;
	time_t time;
	char hostname[256];
	int packaged;
	unsigned long long inode;
	union {
		struct {
			int childcount;
		} dir;
		struct {
			int executable;
................................................................................
	char *hostname, *packagename, *os_cpuArch, *os, *cpuArch, *version;
	char *path, *path_s;
	char *package_hash;
	char *sql;
	int files_count;
	int fileinfo_ret, retval;

	/* Initialize return */
	if (children) {
		*children = NULL;
	}

	/* Verify that this is a valid request */
	if (_path == NULL) {
		return(-ENOENT);
	}

	if (_path[0] != '/') {
		return(-ENOENT);
	}

	/* Note that this is not a "real" directory from a package */
	pathinfo->packaged = 0;

	if (_path[1] == '\0') {
		/* Request for the root directory */
		pathinfo->hostname[0] = '\0';
		pathinfo->inode = 1;

		sql = sqlite3_mprintf("SELECT DISTINCT hostname FROM packages;");
................................................................................
		path = "";
	} else {
		*path = '\0';
		path++;
	}

	/* Request for a file in a specific package */
	pathinfo->packaged = 1;
	APPFS_DEBUG("Requesting information for hostname = %s, package = %s, os = %s, cpuArch = %s, version = %s, path = %s", 
		hostname, packagename, os, cpuArch, version, path
	);

	package_hash = appfs_lookup_package_hash(hostname, packagename, os, cpuArch, version);
	if (package_hash == NULL) {
		free(path_s);
................................................................................
			break;
		case APPFS_PATHTYPE_INVALID:
			res = -EIO;

			break;
	}

	if (pathinfo.packaged) {
		if (globalThread.options.writable) {
			stbuf->st_mode |= 0222;
		}
	}

	return res;
}

static int appfs_fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) {
	struct appfs_pathinfo pathinfo;