Check-in [651fd8051a]
Overview
Comment:Updated to decrement reference count for objects as we are done with them
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 651fd8051a57864eacbe5df537764f873df65f67
User & Date: rkeene on 2014-11-14 06:13:49
Other Links: manifest | tags
Context
2014-11-14
17:25
Made an optional exit path and removed decrementing of reference counters check-in: ec17efd4bb user: rkeene tags: trunk
06:13
Updated to decrement reference count for objects as we are done with them check-in: 651fd8051a user: rkeene tags: trunk
05:20
Added back completely needed operation check-in: 84483d5933 user: rkeene tags: trunk
Changes

Modified appfsd.c from [cb5c5230cc] to [4a8cebc0f0].

755
756
757
758
759
760
761



762
763
764
765
766
767
768
769
770
771
772


773
774
775
776
777
778
779
780
781
782
783
784
785
786


787
788
789
790
791
792
793
794


795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811


812
813
814
815
816
817
818
819
820


821
822
823
824
825
826
827
828


829
830
831
832
833
834
835
836


837
838
839
840
841
842
843
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860







+
+
+











+
+














+
+








+
+

















+
+









+
+








+
+








+
+







		return(-EIO);
	}

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

	attr_value_str = Tcl_GetString(attr_value);

	Tcl_DecrRefCount(attr_value);

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

			Tcl_DictObjGet(interp, attrs_dict, attr_key_childcount, &attr_value);
			if (attr_value != NULL) {
				tcl_ret = Tcl_GetWideIntFromObj(NULL, attr_value, &attr_value_wide);
				if (tcl_ret == TCL_OK) {
					pathinfo->typeinfo.dir.childcount = attr_value_wide;
				}

				Tcl_DecrRefCount(attr_value);
			}

			break;
		case 'f': /* file */
			pathinfo->type = APPFS_PATHTYPE_FILE;
			pathinfo->typeinfo.file.size = 0;
			pathinfo->typeinfo.file.executable = 0;

			Tcl_DictObjGet(interp, attrs_dict, attr_key_size, &attr_value);
			if (attr_value != NULL) {
				tcl_ret = Tcl_GetWideIntFromObj(NULL, attr_value, &attr_value_wide);
				if (tcl_ret == TCL_OK) {
					pathinfo->typeinfo.file.size = attr_value_wide;
				}

				Tcl_DecrRefCount(attr_value);
			}

			Tcl_DictObjGet(interp, attrs_dict, attr_key_perms, &attr_value);
			if (attr_value != NULL) {
				attr_value_str = Tcl_GetString(attr_value);
				if (attr_value_str[0] == 'x') {
					pathinfo->typeinfo.file.executable = 1;
				}

				Tcl_DecrRefCount(attr_value);
			}
			break;
		case 's': /* symlink */
			pathinfo->type = APPFS_PATHTYPE_SYMLINK;
			pathinfo->typeinfo.symlink.size = 0;
			pathinfo->typeinfo.symlink.source[0] = '\0';

			Tcl_DictObjGet(interp, attrs_dict, attr_key_source, &attr_value);
			if (attr_value != NULL) {
				attr_value_str = Tcl_GetStringFromObj(attr_value, &attr_value_int); 

				if ((attr_value_int + 1) <= sizeof(pathinfo->typeinfo.symlink.source)) {
					pathinfo->typeinfo.symlink.size = attr_value_int;
					pathinfo->typeinfo.symlink.source[attr_value_int] = '\0';

					memcpy(pathinfo->typeinfo.symlink.source, attr_value_str, attr_value_int);
				}

				Tcl_DecrRefCount(attr_value);
			}
			break;
		case 'F': /* pipe/fifo */
			pathinfo->type = APPFS_PATHTYPE_FIFO;
			break;
		case 'S': /* UNIX domain socket */
			pathinfo->type = APPFS_PATHTYPE_SOCKET;
			break;
		default:
			Tcl_DecrRefCount(attrs_dict);

			Tcl_Release(interp);

			return(-EIO);
	}

	Tcl_DictObjGet(interp, attrs_dict, attr_key_packaged, &attr_value);
	if (attr_value != NULL) {
		pathinfo->packaged = 1;

		Tcl_DecrRefCount(attr_value);
	}

	Tcl_DictObjGet(interp, attrs_dict, attr_key_time, &attr_value);
	if (attr_value != NULL) {
		tcl_ret = Tcl_GetWideIntFromObj(NULL, attr_value, &attr_value_wide);
		if (tcl_ret == TCL_OK) {
			pathinfo->time = attr_value_wide;
		}

		Tcl_DecrRefCount(attr_value);
	} else {
		pathinfo->time = 0;
	}

	Tcl_Release(interp);

	appfs_get_path_info_cache_add(path, fsuid, pathinfo);
1046
1047
1048
1049
1050
1051
1052


1053
1054
1055
1056
1057
1058
1059
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078







+
+








		return(0);
	}

	for (idx = 0; idx < children_count; idx++) {
		filler(buf, Tcl_GetString(children[idx]), NULL, 0);
	}

	Tcl_DecrRefCount(children);

	Tcl_Release(interp);

	return(0);
}

static int appfs_fuse_open(const char *path, struct fuse_file_info *fi) {