disp3.c revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "dispatch.h"
#include <syslog.h>
/**
** remount_form() - MOUNT A FORM WHERE ANOTHER WAS MOUNTED
**/
void
{
trayNum--; /* make zero based */
/* force it */
return; /* nothing to do */
return; /* nothing to do */
}
/*
* Unmount the old form.
*/
/*
* Unmounting the form may make some print requests
* no longer printable, because they were accepted
* only because the form was already mounted.
* Unmounting the form will also force some requests
* to another printer (where the form is mounted)
* so they can print.
*/
/*
* Maybe an alert is due.
*/
}
/*
* Mount the new form?
*/
if (pfs) {
sizeof(PFSTATUS));
}
} else {
return; /* nothing to do, can't mount form,
so no need to pretend we did */
}
/*
* Attract all the requests needing this newly mounted
* form. This may cause some unnecessary shuffling, but
* we have to ensure requests aren't assigned to a printer
* without the form mounted, so that the alert check is
* correct.
*/
/*
* Maybe an alert can be shut off.
*/
}
} else {
/*
* Attract first request that doesn't need a form mounted.
* We only need to get one request printing, because it
* completing will cause the next request to be attracted.
*/
form_in_question = 0;
}
dump_pstatus ();
return;
}
/**
** remount_pwheel() - MOUNT A PRINT-WHEEL WHERE ANOTHER WAS MOUNTED
**/
static void
{
return; /* nothing to do */
/*
* Unmount the old print wheel
*/
if (pps->pwheel_name) {
if (Oppws)
/*
* Unmounting the print wheel may make some print
* requests no longer printable, because they were
* accepted only because the print wheel was already
* mounted. Unmounting the print wheel will also force
* some requests to another printer (where the print wheel
* is mounted) so they can print.
*/
/*
* Maybe an alert is due.
*/
if (Oppws)
}
/*
* Mount the new print wheel?
*/
if (pwheel_name) {
/*
* Attract all requests needing this newly
* mounted print wheel. This may cause some
* unnecessary shuffling, but we have to ensure
* requests aren't assigned to a printer without
* the print-wheel mounted, so that the alert
* check is correct.
*/
/*
* Maybe an alert can be shut off.
*/
}
} else {
/*
* Attract the first request that needs this newly
* mounted print wheel. If no alert has been
* defined for the print wheel, we don't know how
* many requests are queued waiting for it, so we
* have to do this unconditionally.
*/
}
} else {
/*
* Attract the first request that doesn't need a
* print wheel mounted.
* We only need to get one request printing, because it
* completing will cause the next request to be attracted.
*/
pwheel_in_question = 0;
}
dump_pstatus ();
return;
}
#define MAX_TRAYS 100
/**
** s_max_trays()
**/
void
{
char *printer;
short numTrays;
numTrays);
/* Have we seen this printer before? */
/* How about the tray? */
/* If the printer is currently printing, we can't disturb it. */
else {
int i;
ppfs[i].isAvailable = 0;
}
}
} else {
}
dump_pstatus();
}
/**
** s_mount()
**/
void
{
if (!*form && !*pwheel_name)
/* Have we seen this printer before? */
/* How about the form? */
/* If the printer is currently printing, we can't disturb it. */
else {
/*
* Mount them.
*/
if (*form)
if (*pwheel_name)
}
}
/*
* s_mount_tray()
*/
void
{
short trayNum;
&trayNum);
if (!*form && !*pwheel_name)
/* Have we seen this printer before? */
/* How about the form? */
/* How about the tray? */
/* If the printer is currently printing, we can't disturb it. */
else {
/*
* Mount them.
*/
if (*form)
if (*pwheel_name)
}
}
/**
** s_unmount()
**/
void
{
char *printer,
*form,
if (!*form && !*pwheel_name)
/*
* Have we seen this printer before?
*/
/*
* If the printer is currently printing a request,
*/
else {
/*
* Unmount them.
*/
if (*form)
if (*pwheel_name)
remount_pwheel (pps, (char *)0);
}
return;
}
/**
** s_unmount_tray()
**/
void
{
char *printer,
*form,
short trayNum;
&trayNum);
if (!*form && !*pwheel_name)
/* haven't seen this printer before */
/* haven't seen the tray before */
/* is the printer busy */
else {
/* Unmount them. */
if (*form)
if (*pwheel_name)
remount_pwheel (pps, (char *)0);
}
return;
}
/**
** s_load_form()
**/
void
{
char *form;
if (!*form)
/* no form specified */
/* strange or missing form */
switch (errno) {
case EBADF:
break;
case ENOENT:
default:
break;
}
/* Have we seen this form before? */
&pfs->users_allowed,
);
/*
* These have to be done in the order shown,
* and after the assignments above, so that all
* the new information is in place for the
* checks. An unfortunate side effect is that
* it is possible for the alert to shut off
* and then come on again, if (1) enough requests
* are canceled to drop the level below the old
* alert threshold, but (2) the new alert threshold
* is even lower. The final alert will be correct,
* though.
*/
/*
* Room for a new form?
*/
/*
* No alert is possible for a new form, of course,
* but this routine does a bit more than just check
* the alert.
*/
} else {
}
return;
}
/**
** s_unload_form()
**/
static void
{
int i;
short numForms;
/*
* Unmount this form everywhere and get rid of it.
*/
int j;
for ( j = 0 ; j < numForms ; j++ )
}
return;
}
void
{
char *form;
int i;
/* If we have a request queued for ANY form, we can't do it. */
break;
}
}
_unload_form (FStatus[i]);
}
/* Have we seen this form before? */
else {
/* Is there even one request waiting for this form? */
break;
}
_unload_form (pfs);
}
}
return;
}
/**
** s_load_printwheel()
**/
void
{
char *pwheel_name;
if (!*pwheel_name)
/* no printwheel specified */
/* Strange or missing print wheel? */
switch (errno) {
case EBADF:
break;
case ENOENT:
default:
break;
}
/* Print wheel we already know about? */
/* Room for a new print wheel? */
/*
* Because of the quirky nature of the print wheel
* structures, i.e. no structure unless an alert has
* been defined, we have to run through the requests
* and see which ones are waiting for this print wheel,
* so we can assign alerts and count pending requests.
*/
(!one_printer_with_charsets(prs))) {
}
} else {
freepwheel (ppw);
}
return;
}
/**
** s_unload_printwheel()
**/
static void
{
int i;
/*
* ``Unmount'' the alert part of this print wheel everywhere.
* THIS IS NOT A COMPLETE UNMOUNT, JUST THE ALERT STRUCTURE
* IS REMOVED.
*/
/*
* Remove the alert part from all requests.
*/
/*
* Cancel any alert pending. Here we're different from the
* similar code for unloading a form, because, to be able to
* unload a form we first require NO requests pending. If no
* requests are pending there should be no alert to cancel.
* Print wheels, on the other hand, only exist as names and
* alerts. We can always unload a ``print wheel'' because
* all we're really unloading is an alert. Thus, there can
* be requests queued for the print wheel (the name), and
* thus there can be an alert running.
*/
return;
}
void
{
char *pwheel_name;
/*
* We don't care if any requests are waiting for the print
* wheel(s)--what we're removing here is (are) just the alert(s)!
*/
/*
* Remove all print wheel alerts?
*/
int i;
_unload_pwheel (PWStatus[i]);
/*
* Have we seen this print wheel before?
*/
else {
}
return;
}