コード例 #1
0
ファイル: amq_subr.c プロジェクト: CTSRD-CHERI/cheribsd
/*
 * Return a sub-tree of mounts
 */
amq_mount_tree_p *
amqproc_mnttree_1_svc(voidp argp, struct svc_req *rqstp)
{
  static am_node *mp;

  mp = find_ap(*(char **) argp);
  return (amq_mount_tree_p *) ((void *)&mp);
}
コード例 #2
0
ファイル: autofs_solaris_v1.c プロジェクト: ryo/netbsd-src
static int
autofs_mount_1_req(struct mntrequest *m,
                   struct mntres *res,
                   struct authunix_parms *cred,
                   SVCXPRT *transp)
{
    int err = 0;
    int isdirect = 0;
    am_node *mp, *ap;
    mntfs *mf;

    dlog("MOUNT REQUEST: name=%s map=%s opts=%s path=%s",
         m->name, m->map, m->opts, m->path);

    /* find the effective uid/gid from RPC request */
    xsnprintf(opt_uid, sizeof(uid_str), "%d", (int) cred->aup_uid);
    xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) cred->aup_gid);

    mp = find_ap(m->path);
    if (!mp) {
        plog(XLOG_ERROR, "map %s not found", m->path);
        err = ENOENT;
        goto out;
    }

    mf = mp->am_al->al_mnt;
    isdirect = (mf->mf_fsflags & FS_DIRECT) ? 1 : 0;
    ap = mf->mf_ops->lookup_child(mp, m->name + isdirect, &err, VLOOK_CREATE);
    if (ap && err < 0)
        ap = mf->mf_ops->mount_child(ap, &err);
    if (ap == NULL) {
        if (err < 0) {
            /* we're working on it */
            amd_stats.d_drops++;
            return 1;
        }
        err = ENOENT;
        goto out;
    }

out:
    if (err) {
        if (isdirect) {
            /* direct mount */
            plog(XLOG_ERROR, "mount of %s failed", m->path);
        } else {
            /* indirect mount */
            plog(XLOG_ERROR, "mount of %s/%s failed", m->path, m->name);
        }
    }

    dlog("MOUNT REPLY: status=%d (%s)", err, strerror(err));

    res->status = err;
    return 0;
}
コード例 #3
0
static am_node *
get_root_ap(char *dir)
{
  am_node *mp = find_ap(dir);

  if (mp && mp->am_parent == root_node)
    return mp;

  return 0;
}
コード例 #4
0
static void
wireless_applet_scan (WirelessApplet *applet)
{
	GList *filtered_list = NULL;
	GList *l = NULL;
	GList *ap_list = NULL;
	time_t stamp = 0;
	
	iw_scan (applet->skfd, applet->device, scan_handler, applet);

	ap_list = applet->scan_list;
	applet->scan_list = NULL;
	
	for (l = ap_list; l; l = l->next) {
		wireless_ap *ap = l->data;
		wireless_ap *found_ap = find_ap (filtered_list, ap->essid);

		if (found_ap != NULL) {
			if (found_ap->quality < ap->quality) {
				/* we want to display the max quality of
				 * a given essid	
				 */
				found_ap->quality = ap->quality;
				iw_wireless_ap_free (ap);
			}
		} else {
			filtered_list = g_list_append (filtered_list, ap);
		}
	}

	g_list_free (ap_list);

	for (l = filtered_list; l; l = l->next) {
		wireless_ap *ap = l->data;
		GtkTreeIter iter;

		if (!wireless_applet_find_mac (applet, ap->address, &iter)) {
			
			gtk_list_store_append (applet->ap_store,
					       &iter);
		}
		
		gtk_list_store_set (applet->ap_store,
				    &iter, 0, ap, -1);
		stamp = ap->stamp;
	}

	if (stamp != 0) {
		wireless_applet_remove_old_ap (applet, stamp);
	}

	//g_list_foreach (filtered_list, (GFunc)iw_wireless_ap_free, NULL);
	g_list_free (filtered_list);
}
コード例 #5
0
ファイル: amq_subr.c プロジェクト: CTSRD-CHERI/cheribsd
/*
 * Unmount a single node
 */
int *
amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp)
{
  static int res = AMQ_UMNT_OK;
  am_node *mp = find_ap(*(char **) argp);

  if (mp)
    forcibly_timeout_mp(mp);

  return &res;
}
コード例 #6
0
/*ARGSUSED*/
void *
amqproc_umnt_1(void *argp, struct svc_req *rqstp)
{
    static char res;

    am_node *mp = find_ap(*(char **) argp);
    if (mp)
        forcibly_timeout_mp(mp);

    return (void *)&res;
}
コード例 #7
0
ファイル: shell.c プロジェクト: 7u83/actube
send_cmd(struct shelldata * sd, const char *cmd)
{
	struct conn * conn;
	wtplist_lock();
	conn = find_ap(sd->prompt);
	if (conn==NULL){
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
	}
	else {
		conn->update_cfg=sd->update_cfg;
	}
	wtplist_unlock();
}
コード例 #8
0
ファイル: shell.c プロジェクト: 7u83/actube
void cfg_cmd(struct shelldata *sd, const char *cmd)
{
	struct conn * conn;
	wtplist_lock();
	conn = find_ap(sd->prompt);
	if (conn==NULL){
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
	}
	else {
		show_cfg(sd->out,conn->remote_cfg);
	}
	wtplist_unlock();
}
コード例 #9
0
ファイル: amq_subr.c プロジェクト: CTSRD-CHERI/cheribsd
/*
 * Synchronously unmount a single node - child side.
 */
amq_sync_umnt *
amqproc_sync_umnt_1_svc_child(voidp argp, struct svc_req *rqstp)
{
  static amq_sync_umnt rv;
  amq_sync_umnt buf;
  ssize_t n;

  am_node *mp = find_ap(*(char **) argp);

  memset(&rv, 0, sizeof(rv));
  rv.au_etype = AMQ_UMNT_READ;
  if (mp && mp->am_fd[0] >= 0) {
    n = read(mp->am_fd[0], &buf, sizeof(buf));
    if (n == sizeof(buf))
      rv = buf;
  }
  return &rv;
}
コード例 #10
0
ファイル: autofs_linux.c プロジェクト: enukane/netbsd-src
static void
autofs_expire_one(am_node *mp, char *name, unsigned long token)
{
  autofs_fh_t *fh;
  am_node *ap;
  struct autofs_pending_umount *p;
  char *ap_path;

  fh = mp->am_autofs_fh;

  ap_path = str3cat(NULL, mp->am_path, "/", name);
  if (amuDebug(D_TRACE))
    plog(XLOG_DEBUG, "\tumount(%s)", ap_path);

  p = fh->pending_umounts;
  while (p && p->wait_queue_token != token)
    p = p->next;

  if (p) {
    /* already pending */
    dlog("Umounting of %s already pending", ap_path);
    amd_stats.d_drops++;
    goto out;
  }

  ap = find_ap(ap_path);
  if (ap == NULL) {
    /* not found??? not sure what to do here... */
    send_fail(fh->ioctlfd, token);
    goto out;
  }

  p = ALLOC(struct autofs_pending_umount);
  p->wait_queue_token = token;
  p->name = strdup(name);
  p->next = fh->pending_umounts;
  fh->pending_umounts = p;

  unmount_mp(ap);

out:
  XFREE(ap_path);
}
コード例 #11
0
 * 1) Setup IPC pipe.
 * 2) Set signal masks.
 * 3) Fork by calling background() so that NumChildren is updated.
 */
static int
amq_fork(opaque_t argp)
{
#ifdef HAVE_SIGACTION
  sigset_t new, mask;
#else /* not HAVE_SIGACTION */
  int mask;
#endif /* not HAVE_SIGACTION */
  am_node *mp;
  pid_t pid;

  mp = find_ap(*(char **) argp);
  if (mp == NULL) {
    errno = 0;
    return -1;
  }

  if (pipe(mp->am_fd) == -1) {
    mp->am_fd[0] = -1;
    mp->am_fd[1] = -1;
    return -1;
  }

#ifdef HAVE_SIGACTION
  sigemptyset(&new);		/* initialize signal set we wish to block */
  sigaddset(&new, SIGHUP);
  sigaddset(&new, SIGINT);