// change the permission mode of the file static int my_chmod(const char *path, mode_t mode) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = chmod(fullpath, mode); return res; }
// change the owner/group of the file static int my_chown(const char *path, uid_t uid, gid_t gid) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = chown(fullpath, uid, gid); return res; }
// update the access/modifiy time of one file static int my_utimes(const char *path, struct utimebuf *ubuffer) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = utime(fullpath, ubuffer); return res; }
// remove one file static int my_unlink(const char *path) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = unlink(fullpath); return res; }
// delete directory static int my_rmdir(const char *path) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = rmdir(fullpath); return res; }
// open directory static int my_open(const char *path, struct fuse_file_info *file) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = open(fullpath, file->flags); return res; }
static int my_getattr(const char *path, struct stat *statbuf) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = lstat(fullpath, statbuf); return res; }
// create one file, using create syscall. static int my_create(const char *path, mode_t mode, struct fuse_file_info *file) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = creat(fullpath, mode); file->fh = res; return res; }
// check the file access permissions, using the access() system call static int my_access(const char *path, int mask) { int res = 0; char fullpath[PATH_MAX]; my_fullpath(fullpath, path); res = access(fullpath, mask); return res; }
streng *os2_directory( tsd_t *TSD, cparamboxptr parms ) { streng *result=NULL ; int ok=HOOK_GO_ON ; char *path; checkparam( parms, 0, 1 , "DIRECTORY" ) ; if (parms&&parms->value) { if (TSD->systeminfo->hooks & HOOK_MASK(HOOK_SETCWD)) ok = hookup_output( TSD, HOOK_SETCWD, parms->value ) ; if (ok==HOOK_GO_ON) { path = str_of( TSD, parms->value ) ; if (chdir( path ) ) { FreeTSD( path ) ; return nullstringptr() ; } FreeTSD( path ) ; } } /* * The remainder of this is for obtaining the current working directory... */ if (TSD->systeminfo->hooks & HOOK_MASK(HOOK_GETCWD)) ok = hookup_input( TSD, HOOK_GETCWD, &result ) ; if (ok==HOOK_GO_ON) { result = Str_makeTSD( REXX_PATH_MAX ); my_fullpath( result->value, "." ); result->len = strlen( result->value ); } return result; }