Esempio n. 1
0
/* Callback function needed for calls to fshelp_fetch_root.  See
   <hurd/fshelp.h> for the interface description.  */
static error_t
_netfs_translator_callback2_fn (void *cookie1, void *cookie2, int flags,
				mach_port_t *underlying,
				mach_msg_type_name_t *underlying_type)
{
  error_t err;
  struct protid *cred;
  struct node *node = cookie1;
  struct iouser *user;

  err = iohelp_create_simple_iouser (&user, node->nn_stat.st_uid,
				   node->nn_stat.st_gid);
  if (err)
    return err;

  cred = netfs_make_protid (netfs_make_peropen (node, flags, cookie2),
			    user);
  if (cred)
    {
      *underlying = ports_get_right (cred);
      *underlying_type = MACH_MSG_TYPE_MAKE_SEND;
      ports_port_deref (cred);
      return 0;
    }
  else
    {
      iohelp_free_iouser (user);
      return errno;
    }
}
Esempio n. 2
0
error_t
netfs_S_fsys_syncfs (mach_port_t cntl,
		     mach_port_t reply,
		     mach_msg_type_name_t reply_type,
		     int wait,
		     int children)
{
  struct iouser *cred;
  error_t err;

  err = iohelp_create_simple_iouser (&cred, 0, 0);
  if (err)
    return err;
  err = netfs_attempt_syncfs (cred, wait);
  iohelp_free_iouser (cred);
  return err;
}