Diff

Differences From Artifact [6a9a58fb18]:

To Artifact [070b2bd8e3]:


   814    814   	return(write_ret);
   815    815   }
   816    816   
   817    817   static int appfs_fuse_mknod(const char *path, mode_t mode, dev_t device) {
   818    818   	char *real_path;
   819    819   	int mknod_ret;
   820    820   
          821  +	APPFS_DEBUG("Enter (path = %s, ...)", path);
          822  +
   821    823   	if ((mode & S_IFCHR) == S_IFCHR) {
   822    824   		return(-EPERM);
   823    825   	}
   824    826   
   825    827   	if ((mode & S_IFBLK) == S_IFBLK) {
   826    828   		return(-EPERM);
   827    829   	}
................................................................................
   842    844   	return(0);
   843    845   }
   844    846   
   845    847   static int appfs_fuse_create(const char *path, mode_t mode, struct fuse_file_info *fi) {
   846    848   	int fd;
   847    849   	int chmod_ret;
   848    850   
          851  +	APPFS_DEBUG("Enter (path = %s, ...)", path);
          852  +
   849    853   	fd = appfs_fuse_open(path, fi);
   850    854   	if (fd < 0) {
   851    855   		return(fd);
   852    856   	}
   853    857   
   854    858   	chmod_ret = fchmod(fd, mode);
   855    859   	if (chmod_ret != 0) {
................................................................................
   861    865   	return(fd);
   862    866   }
   863    867   
   864    868   static int appfs_fuse_truncate(const char *path, off_t size) {
   865    869   	char *real_path;
   866    870   	int truncate_ret;
   867    871   
          872  +	APPFS_DEBUG("Enter (path = %s, ...)", path);
          873  +
   868    874   	real_path = appfs_localpath(path);
   869    875   	if (real_path == NULL) {
   870    876   		return(-EIO);
   871    877   	}
   872    878   
   873    879   	truncate_ret = truncate(real_path, size);
   874    880   
   875    881   	free(real_path);
   876    882   
   877    883   	if (truncate_ret != 0) {
   878    884   		return(errno * -1);
   879    885   	}
   880    886   
   881         -	return(truncate_ret);
          887  +	return(0);
          888  +}
          889  +
          890  +static int appfs_fuse_unlink_rmdir(const char *path) {
          891  +	Tcl_Interp *interp;
          892  +	int tcl_ret;
          893  +
          894  +	APPFS_DEBUG("Enter (path = %s, ...)", path);
          895  +
          896  +	interp = appfs_TclInterp();
          897  +	if (interp == NULL) {
          898  +		return(-EIO);
          899  +	}
          900  +
          901  +	tcl_ret = appfs_Tcl_Eval(interp, 2, "::appfs::unlinkpath", path);
          902  +	if (tcl_ret != TCL_OK) {
          903  +		APPFS_DEBUG("::appfs::unlinkpath(%s) failed.", path);
          904  +		APPFS_DEBUG("Tcl Error is: %s", Tcl_GetStringResult(interp));
          905  +
          906  +		return(-EIO);
          907  +	}
          908  +
          909  +	return(0);
          910  +}
          911  +
          912  +static int appfs_fuse_mkdir(const char *path, mode_t mode) {
          913  +	char *real_path;
          914  +	int mkdir_ret;
          915  +
          916  +	APPFS_DEBUG("Enter (path = %s, ...)", path);
          917  +
          918  +	real_path = appfs_prepare_to_create(path);
          919  +	if (real_path == NULL) {
          920  +		return(-EIO);
          921  +	}
          922  +
          923  +	mkdir_ret = mkdir(real_path, mode);
          924  +
          925  +	free(real_path);
          926  +
          927  +	if (mkdir_ret != 0) {
          928  +		if (errno != EEXIST) {
          929  +			return(errno * -1);
          930  +		}
          931  +	}
          932  +
          933  +	return(0);
   882    934   }
   883    935   
   884    936   /*
   885    937    * SQLite3 mode: Execute raw SQL and return success or failure
   886    938    */
   887    939   static int appfs_sqlite3(const char *sql) {
   888    940   	Tcl_Interp *interp;
................................................................................
   972   1024   	.open      = appfs_fuse_open,
   973   1025   	.release   = appfs_fuse_close,
   974   1026   	.read      = appfs_fuse_read,
   975   1027   	.write     = appfs_fuse_write,
   976   1028   	.mknod     = appfs_fuse_mknod,
   977   1029   	.create    = appfs_fuse_create,
   978   1030   	.truncate  = appfs_fuse_truncate,
         1031  +	.unlink    = appfs_fuse_unlink_rmdir,
         1032  +	.rmdir     = appfs_fuse_unlink_rmdir,
         1033  +	.mkdir     = appfs_fuse_mkdir,
   979   1034   };
   980   1035   
   981   1036   /*
   982   1037    * FUSE option parsing callback
   983   1038    */
   984   1039   static int appfs_fuse_opt_cb(void *data, const char *arg, int key, struct fuse_args *outargs) {
   985   1040   	static int seen_cachedir = 0;