From 9d1275ccf45077b4b4eb67c885f12d7d7f5b7ece Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Thu, 22 Sep 1994 22:35:53 +0000 Subject: [PATCH] Add two new flags: -q just shut up, will you?! -u unlink output file after successful load --- sbin/modload/modload.8 | 15 ++++++++++----- sbin/modload/modload.c | 23 +++++++++++++++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/sbin/modload/modload.8 b/sbin/modload/modload.8 index 36d099ba5a46..d2aaac6d9f87 100644 --- a/sbin/modload/modload.8 +++ b/sbin/modload/modload.8 @@ -23,9 +23,9 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: modload.8,v 1.3 1994/08/19 13:39:20 davidg Exp $ +.\" $Id: modload.8,v 1.4 1994/09/18 04:12:12 davidg Exp $ .\" -.Dd June 7, 1993 +.Dd September 22, 1994 .Dt MODLOAD 8 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd load a kernel module .Sh SYNOPSIS .Nm modload -.Op Fl dv +.Op Fl dquv .Op Fl A Ar kernel .Op Fl e Ar entry .Op Fl p Ar postinstall @@ -53,6 +53,12 @@ are as follows: Debug. Used to debug .Nm itself. +.It Fl q +Be very quiet. +.It Fl u +Delete the loaded module +.Pq Ar output_file +after loading. .It Fl v Print comments about the loading process. .It Fl A Ar kernel @@ -111,6 +117,5 @@ to the corresponding command in Terrence R. Lambert, terry@cs.weber.edu .El .Sh BUGS -Loadable streams modules and loadable execution interpreters -are not currently supported. The loadable device driver framework can +The loadable device driver framework can only reserve either a character or block device entry, not both. diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index c7c4ab9dbb25..246823997dd6 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: modload.c,v 1.2 1994/08/19 13:28:21 davidg Exp $ + * $Id: modload.c,v 1.3 1994/09/18 04:12:13 davidg Exp $ */ #include @@ -65,6 +65,8 @@ int debug = 0; int verbose = 0; +int quiet = 0; +int dounlink = 0; int linkcmd(kernel, entry, outfile, address, object) @@ -108,7 +110,7 @@ usage() { fprintf(stderr, "usage:\n"); - fprintf(stderr, "modload [-d] [-v] [-A ] [-e ] [-e ] [-o ] \n"); exit(1); @@ -159,7 +161,7 @@ main(argc, argv) int sz, bytesleft; char buf[MODIOBUF]; - while ((c = getopt(argc, argv, "dvA:e:p:o:")) != EOF) { + while ((c = getopt(argc, argv, "dvquA:e:p:o:")) != EOF) { switch (c) { case 'd': debug = 1; @@ -167,6 +169,12 @@ main(argc, argv) case 'v': verbose = 1; break; /* verbose */ + case 'u': + dounlink = 1; + break; + case 'q': + quiet = 1; + break; case 'A': kname = optarg; break; /* kernel */ @@ -329,7 +337,7 @@ main(argc, argv) * Success! */ fileopen &= ~PART_RESRV; /* loaded */ - printf("Module loaded as ID %d\n", resrv.slot); + if(!quiet) printf("Module loaded as ID %d\n", resrv.slot); if (post) { struct lmc_stat sbuf; @@ -346,5 +354,12 @@ main(argc, argv) execl(post, post, id, type, offset, 0); err(16, "can't exec '%s'", post); } + + if(dounlink) { + if(unlink(out)) { + err(17, "unlink(%s)", out); + } + } + return 0; }