Exemplo n.º 1
0
static int xmp_getattr(const char *path, struct stat *stbuf)
{
int res;
//pass_msg("getattr");
struct request_potato vrequest_potato;
struct reply_potato vreply_potato;
vrequest_potato.Opcode=4;
strcpy(vrequest_potato.fpath,path);
vreply_potato.rc=0;
vreply_potato=pass_msg(vrequest_potato);

printf("\npath=%s\n",path);

//populate
  copy_stat(stbuf,vreply_potato);

res=vreply_potato.rc;
printf("\nattr_value=%d\n",res);
//res = lstat(path, stbuf);

if (vreply_potato.rc == -1)
return vreply_potato.errno_t;

return 0;
}
Exemplo n.º 2
0
long sys_lstat(const char* name, void* st)
{
  struct frontend_stat buf;
  size_t name_size = strlen(name)+1;
  long ret = frontend_syscall(SYS_lstat, (uintptr_t)name, name_size, (uintptr_t)&buf, 0, 0, 0, 0);
  copy_stat(st, &buf);
  return ret;
}
Exemplo n.º 3
0
int fstatat(int dirfd, const char *pathname, struct stat *buf, int flags)
{
   kernel_stat s;
   int ret;
   ret = syscall(__NR_newfstatat, dirfd, pathname, &s, flags);
   copy_stat(buf, &s);
   return ret;
}
Exemplo n.º 4
0
int fstat(int fp, struct stat *st)
{
  kernel_stat s;
  int ret;
  ret = syscall (__NR_fstat, fp, &s);
  copy_stat (st, &s);
  return ret;
}
Exemplo n.º 5
0
long sys_fstatat(int dirfd, const char* name, void* st, int flags)
{
  int kfd = at_kfd(dirfd);
  if (kfd != -1) {
    struct frontend_stat buf;
    size_t name_size = strlen(name)+1;
    long ret = frontend_syscall(SYS_fstatat, kfd, (uintptr_t)name, name_size, (uintptr_t)&buf, flags, 0, 0);
    copy_stat(st, &buf);
    return ret;
  }
  return -EBADF;
}
static int fscd_getattr(struct workspace_object_struct *object, struct userpolicy_struct *userpolicy, struct inode_struct *inode, char *path, struct stat *st)
{
    int nreturn=-ENOENT;

    logoutput("fscd_gettatr");

    if (inode) {

	if ( strlen(path)==0 || strcmp(path, "/")==0 || strcmp(path, ".")==0 || strcmp(path, "/.")==0 ) {

	    copy_stat(st, &inode->st);
	    nreturn=0;

	}

    }

    return nreturn;

}
static int fscd_lookup(struct workspace_object_struct *object, struct userpolicy_struct *userpolicy, struct entry_struct *entry, char *path, struct fuse_entry_param *e)
{
    int nreturn=-ENOENT;
    struct resource_struct *resource=object->resource;

    if (entry->inode) {
	struct entry_mountdata_struct *fscd_mountdata=NULL;

	logoutput("fscd_lookup: revalidate %s", entry->name);

	/* it's a revalidate */

	copy_stat(&e->attr, &entry->inode->st);

	e->attr_timeout=3600;
	e->entry_timeout=3600;

	nreturn=0;

	/* lookup fscd_mountdata to watch the mount command */

	fscd_mountdata=lookup_entry_mountdata(entry);

	if (! fscd_mountdata) {
	    int res;

	    /* no previous mount pending/mounted/failed */

	    fscd_mountdata=create_entry_mountdata(entry);

	    if (fscd_mountdata) {

		fscd_mountdata->entry=entry;
		fscd_mountdata->workspace_mount=object->workspace_mount;
		fscd_mountdata->mountstatus=OBJECT_MOUNTSTATUS_UNMOUNTED;
		get_current_time(&fscd_mountdata->mounttime);

	    } else {

		nreturn=-ENOMEM;

	    }

	}

	if (fscd_mountdata) {

	    /* only remount if at least some time ago */

	    if (fscd_mountdata->mountstatus==OBJECT_MOUNTSTATUS_FAILED) {
		struct timespec rightnow;

		get_current_time(&rightnow);

		if (is_later(&rightnow, &fscd_mountdata->mounttime, cdrom_options.fscd_remount_timeout_onerror, 0)==1) {

		    /* remount */

		    fscd_mountdata->mountstatus=OBJECT_MOUNTSTATUS_UNMOUNTED;
		    fscd_mountdata->mounttime.tv_sec=rightnow.tv_sec;
		    fscd_mountdata->mounttime.tv_nsec=rightnow.tv_nsec;

		}

	    }

	    if (fscd_mountdata->mountstatus==OBJECT_MOUNTSTATUS_PENDING) {

		wait_for_mount(fscd_mountdata, cdrom_options.fscd_mount_timeout);

	    }

	    if (fscd_mountdata->mountstatus==OBJECT_MOUNTSTATUS_UNMOUNTED) {

		/* only mount when it's not mounted */

		send_internal_message(INTERNALMESSAGE_TYPE_MOUNTOBJECT, (void *) object);

	    }

	}

    }

    return nreturn;

}