Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/eject don't bother to connect to amd unless necessar...
details: https://anonhg.NetBSD.org/src/rev/32d7555bc86f
branches: trunk
changeset: 755819:32d7555bc86f
user: yamt <yamt%NetBSD.org@localhost>
date: Wed Jun 23 18:07:59 2010 +0000
description:
don't bother to connect to amd unless necessary. PR/42207
diffstat:
usr.bin/eject/am_glue.c | 15 ++++++++++++---
usr.bin/eject/am_glue.h | 5 +----
usr.bin/eject/eject.c | 7 ++-----
3 files changed, 15 insertions(+), 12 deletions(-)
diffs (100 lines):
diff -r 94ceb8e46542 -r 32d7555bc86f usr.bin/eject/am_glue.c
--- a/usr.bin/eject/am_glue.c Wed Jun 23 13:52:26 2010 +0000
+++ b/usr.bin/eject/am_glue.c Wed Jun 23 18:07:59 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: am_glue.c,v 1.3 2010/02/26 22:44:17 christos Exp $ */
+/* $NetBSD: am_glue.c,v 1.4 2010/06/23 18:07:59 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: am_glue.c,v 1.3 2010/02/26 22:44:17 christos Exp $");
+__RCSID("$NetBSD: am_glue.c,v 1.4 2010/06/23 18:07:59 yamt Exp $");
#endif /* not lint */
#ifdef HAVE_CONFIG_H
@@ -39,6 +39,8 @@
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
+#include <stdbool.h>
+
#include "am_glue.h"
static CLIENT *clnt;
@@ -85,10 +87,15 @@
return rv;
}
-void
+static void
am_init(void)
{
static const char *server = "localhost";
+ static bool called;
+
+ if (called)
+ return;
+ called = true;
if (ping_pmap() == -1)
return;
@@ -112,6 +119,8 @@
static struct timeval timeout = { ALLOWED_MOUNT_TIME, 0 };
amq_sync_umnt result;
+ am_init();
+
if (clnt == NULL)
return AMQ_UMNT_FAILED;
diff -r 94ceb8e46542 -r 32d7555bc86f usr.bin/eject/am_glue.h
--- a/usr.bin/eject/am_glue.h Wed Jun 23 13:52:26 2010 +0000
+++ b/usr.bin/eject/am_glue.h Wed Jun 23 18:07:59 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: am_glue.h,v 1.1 2009/01/16 17:31:22 christos Exp $ */
+/* $NetBSD: am_glue.h,v 1.2 2010/06/23 18:07:59 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -28,9 +28,6 @@
#ifndef __AM_GLUE_H__
#define __AM_GLUE_H__
-#include <rpc/rpc.h>
-
-void am_init(void);
int am_unmount(const char *);
#endif /* __AM_GLUE_H__ */
diff -r 94ceb8e46542 -r 32d7555bc86f usr.bin/eject/eject.c
--- a/usr.bin/eject/eject.c Wed Jun 23 13:52:26 2010 +0000
+++ b/usr.bin/eject/eject.c Wed Jun 23 18:07:59 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eject.c,v 1.25 2009/01/16 17:31:22 christos Exp $ */
+/* $NetBSD: eject.c,v 1.26 2010/06/23 18:07:59 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#endif /* not lint */
#ifndef lint
-__RCSID("$NetBSD: eject.c,v 1.25 2009/01/16 17:31:22 christos Exp $");
+__RCSID("$NetBSD: eject.c,v 1.26 2010/06/23 18:07:59 yamt Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -332,9 +332,6 @@
int i, nmnts;
const char *dn;
-#ifdef AMD_SUPPORT
- am_init();
-#endif
nmnts = getmntinfo(&mounts, MNT_NOWAIT);
if (nmnts == 0)
err(1, "getmntinfo");
Home |
Main Index |
Thread Index |
Old Index