Diff

Differences From Artifact [ba1c738961]:

To Artifact [6a9a58fb18]:


552
553
554
555
556
557
558


























559
560
561
562
563
564
565
	real_path = Tcl_GetStringResult(interp);
	if (real_path == NULL) {
		return(NULL);
	}

	return(strdup(real_path));
}



























static int appfs_fuse_readlink(const char *path, char *buf, size_t size) {
	struct appfs_pathinfo pathinfo;
	int retval = 0;

	APPFS_DEBUG("Enter (path = %s, ...)", path);








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
	real_path = Tcl_GetStringResult(interp);
	if (real_path == NULL) {
		return(NULL);
	}

	return(strdup(real_path));
}

static char *appfs_localpath(const char *path) {
	Tcl_Interp *interp;
	const char *real_path;
	int tcl_ret;

	interp = appfs_TclInterp();
	if (interp == NULL) {
		return(NULL);
	}

	tcl_ret = appfs_Tcl_Eval(interp, 2, "::appfs::localpath", path);
	if (tcl_ret != TCL_OK) {
		APPFS_DEBUG("::appfs::localpath(%s) failed.", path);
		APPFS_DEBUG("Tcl Error is: %s", Tcl_GetStringResult(interp));

		return(NULL);
	}

	real_path = Tcl_GetStringResult(interp);
	if (real_path == NULL) {
		return(NULL);
	}

	return(strdup(real_path));
}

static int appfs_fuse_readlink(const char *path, char *buf, size_t size) {
	struct appfs_pathinfo pathinfo;
	int retval = 0;

	APPFS_DEBUG("Enter (path = %s, ...)", path);

830
831
832
833
834
835
836




















837
838
839
840
841
842
843
		close(fd);

		return(-EIO);
	}

	return(fd);
}





















/*
 * SQLite3 mode: Execute raw SQL and return success or failure
 */
static int appfs_sqlite3(const char *sql) {
	Tcl_Interp *interp;
	const char *sql_ret;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
		close(fd);

		return(-EIO);
	}

	return(fd);
}

static int appfs_fuse_truncate(const char *path, off_t size) {
	char *real_path;
	int truncate_ret;

	real_path = appfs_localpath(path);
	if (real_path == NULL) {
		return(-EIO);
	}

	truncate_ret = truncate(real_path, size);

	free(real_path);

	if (truncate_ret != 0) {
		return(errno * -1);
	}

	return(truncate_ret);
}

/*
 * SQLite3 mode: Execute raw SQL and return success or failure
 */
static int appfs_sqlite3(const char *sql) {
	Tcl_Interp *interp;
	const char *sql_ret;
925
926
927
928
929
930
931

932
933
934
935
936
937
938
	.readlink  = appfs_fuse_readlink,
	.open      = appfs_fuse_open,
	.release   = appfs_fuse_close,
	.read      = appfs_fuse_read,
	.write     = appfs_fuse_write,
	.mknod     = appfs_fuse_mknod,
	.create    = appfs_fuse_create,

};

/*
 * FUSE option parsing callback
 */
static int appfs_fuse_opt_cb(void *data, const char *arg, int key, struct fuse_args *outargs) {
	static int seen_cachedir = 0;







>







971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
	.readlink  = appfs_fuse_readlink,
	.open      = appfs_fuse_open,
	.release   = appfs_fuse_close,
	.read      = appfs_fuse_read,
	.write     = appfs_fuse_write,
	.mknod     = appfs_fuse_mknod,
	.create    = appfs_fuse_create,
	.truncate  = appfs_fuse_truncate,
};

/*
 * FUSE option parsing callback
 */
static int appfs_fuse_opt_cb(void *data, const char *arg, int key, struct fuse_args *outargs) {
	static int seen_cachedir = 0;