Diff

Differences From Artifact [72840611b5]:

To Artifact [430cff4a7a]:


52
53
54
55
56
57
58

59
60
61
62
63
64
65
	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;







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	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;
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
	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;");







>




>







>
>
>







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
	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;");
874
875
876
877
878
879
880

881
882
883
884
885
886
887
		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);







>







880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
		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);
993
994
995
996
997
998
999

1000
1001

1002
1003
1004
1005
1006
1007
1008
			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;







>
|
|
>







1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
			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;