[prev in list] [next in list] [prev in thread] [next in thread]
List: cups-bugs
Subject: Re: [cups.bugs] [MOD] STR #3654: Remove MaxPrinterHistory and
From: Michael Sweet <msweet () apple ! com>
Date: 2011-03-07 16:14:54
Message-ID: 20110307161455.58A4B3C68101 () dns ! easysw ! com
[Download RAW message or body]
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR Closed w/Resolution]
Fixed in Subversion repository.
Link: http://www.cups.org/str.php?L3654
Version: 1.5-current
Fix Version: 1.5-current (r9587)
["str3654.patch" (text/plain)]
Index: scheduler/conf.c
===================================================================
--- scheduler/conf.c (revision 9586)
+++ scheduler/conf.c (working copy)
@@ -145,7 +145,6 @@
{ "MaxJobsPerUser", &MaxJobsPerUser, CUPSD_VARTYPE_INTEGER },
{ "MaxLeaseDuration", &MaxLeaseDuration, CUPSD_VARTYPE_INTEGER },
{ "MaxLogSize", &MaxLogSize, CUPSD_VARTYPE_INTEGER },
- { "MaxPrinterHistory", &MaxPrinterHistory, CUPSD_VARTYPE_INTEGER },
{ "MaxRequestSize", &MaxRequestSize, CUPSD_VARTYPE_INTEGER },
{ "MaxSubscriptions", &MaxSubscriptions, CUPSD_VARTYPE_INTEGER },
{ "MaxSubscriptionsPerJob", &MaxSubscriptionsPerJob, CUPSD_VARTYPE_INTEGER },
@@ -626,7 +625,6 @@
MaxClients = 100;
MaxClientsPerHost = 0;
MaxLogSize = 1024 * 1024;
- MaxPrinterHistory = 0;
MaxRequestSize = 0;
MultipleOperationTimeout = DEFAULT_TIMEOUT;
ReloadTimeout = DEFAULT_KEEPALIVE;
Index: scheduler/ipp.c
===================================================================
--- scheduler/ipp.c (revision 9586)
+++ scheduler/ipp.c (working copy)
@@ -926,8 +926,6 @@
printer->accepting = 1;
printer->state_message[0] = '\0';
- cupsdAddPrinterHistory(printer);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"Now accepting jobs.");
@@ -1137,7 +1135,6 @@
pclass->name, attr->values[0].boolean, pclass->accepting);
pclass->accepting = attr->values[0].boolean;
- cupsdAddPrinterHistory(pclass);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, pclass, NULL, "%s accepting jobs.",
pclass->accepting ? "Now" : "No longer");
@@ -1184,7 +1181,6 @@
{
strlcpy(pclass->state_message, attr->values[0].string.text,
sizeof(pclass->state_message));
- cupsdAddPrinterHistory(pclass);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, pclass, NULL, "%s",
pclass->state_message);
@@ -1275,8 +1271,6 @@
}
else
{
- cupsdAddPrinterHistory(pclass);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
pclass, NULL, "New class \"%s\" added by \"%s\".",
pclass->name, get_username(con));
@@ -2697,7 +2691,6 @@
printer->name, attr->values[0].boolean, printer->accepting);
printer->accepting = attr->values[0].boolean;
- cupsdAddPrinterHistory(printer);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"%s accepting jobs.",
@@ -2745,7 +2738,6 @@
{
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
- cupsdAddPrinterHistory(printer);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, "%s",
printer->state_message);
@@ -3047,8 +3039,6 @@
}
else
{
- cupsdAddPrinterHistory(printer);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
@@ -6025,7 +6015,6 @@
/* Printer icons */
time_t curtime; /* Current time */
int i; /* Looping var */
- ipp_attribute_t *history; /* History collection */
/*
@@ -6163,23 +6152,6 @@
ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"printer-state-change-time", printer->state_time);
- if (MaxPrinterHistory > 0 && printer->num_history > 0 &&
- cupsArrayFind(ra, "printer-state-history"))
- {
- /*
- * Printer history is only sent if specifically requested, so that
- * older CUPS/IPP clients won't barf on the collection attributes.
- */
-
- history = ippAddCollections(con->response, IPP_TAG_PRINTER,
- "printer-state-history",
- printer->num_history, NULL);
-
- for (i = 0; i < printer->num_history; i ++)
- copy_attrs(history->values[i].collection = ippNew(), printer->history[i],
- NULL, IPP_TAG_ZERO, 0, NULL);
- }
-
if (!ra || cupsArrayFind(ra, "printer-state-message"))
ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT,
"printer-state-message", NULL, printer->state_message);
@@ -6191,7 +6163,6 @@
{
int type; /* printer-type value */
-
/*
* Add the CUPS-specific printer-type attribute...
*/
@@ -8980,7 +8951,6 @@
printer->holding_new_jobs = 1;
cupsdSetPrinterReasons(printer, "+hold-new-jobs");
- cupsdAddPrinterHistory(printer);
if (dtype & CUPS_PRINTER_CLASS)
cupsdLogMessage(CUPSD_LOG_INFO,
@@ -9827,8 +9797,6 @@
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
- cupsdAddPrinterHistory(printer);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"No longer accepting jobs.");
@@ -9904,7 +9872,6 @@
printer->holding_new_jobs = 0;
cupsdSetPrinterReasons(printer, "-hold-new-jobs");
- cupsdAddPrinterHistory(printer);
if (dtype & CUPS_PRINTER_CLASS)
cupsdLogMessage(CUPSD_LOG_INFO,
Index: scheduler/conf.h
===================================================================
--- scheduler/conf.h (revision 9586)
+++ scheduler/conf.h (working copy)
@@ -183,8 +183,6 @@
/* Maximum number of copies per job */
MaxLogSize VALUE(1024 * 1024),
/* Maximum size of log files */
- MaxPrinterHistory VALUE(10),
- /* Maximum printer state history */
MaxRequestSize VALUE(0),
/* Maximum size of IPP requests */
HostNameLookups VALUE(FALSE),
Index: scheduler/printers.c
===================================================================
--- scheduler/printers.c (revision 9586)
+++ scheduler/printers.c (working copy)
@@ -15,7 +15,6 @@
* Contents:
*
* cupsdAddPrinter() - Add a printer to the system.
- * cupsdAddPrinterHistory() - Add the current printer state to the history.
* cupsdCreateCommonData() - Create the common printer data.
* cupsdDeleteAllPrinters() - Delete all printers from the system.
* cupsdDeletePrinter() - Delete a printer from the system.
@@ -155,9 +154,6 @@
p->op_policy_ptr = DefaultPolicyPtr;
- if (MaxPrinterHistory)
- p->history = calloc(MaxPrinterHistory, sizeof(ipp_t *));
-
/*
* Insert the printer in the printer list alphabetically...
*/
@@ -181,67 +177,6 @@
/*
- * 'cupsdAddPrinterHistory()' - Add the current printer state to the history.
- */
-
-void
-cupsdAddPrinterHistory(
- cupsd_printer_t *p) /* I - Printer */
-{
- ipp_t *history; /* History collection */
-
-
- /*
- * Stop early if we aren't keeping history data...
- */
-
- if (MaxPrinterHistory <= 0)
- return;
-
- /*
- * Retire old history data as needed...
- */
-
- p->sequence_number ++;
-
- if (p->num_history >= MaxPrinterHistory)
- {
- p->num_history --;
- ippDelete(p->history[0]);
- memmove(p->history, p->history + 1, p->num_history * sizeof(ipp_t *));
- }
-
- /*
- * Create a collection containing the current printer-state, printer-up-time,
- * printer-state-message, and printer-state-reasons attributes.
- */
-
- history = ippNew();
- ippAddInteger(history, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state",
- p->state);
- ippAddBoolean(history, IPP_TAG_PRINTER, "printer-is-accepting-jobs",
- p->accepting);
- ippAddBoolean(history, IPP_TAG_PRINTER, "printer-is-shared", p->shared);
- ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-state-message",
- NULL, p->state_message);
- if (p->num_reasons == 0)
- ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "printer-state-reasons", NULL, "none");
- else
- ippAddStrings(history, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "printer-state-reasons", p->num_reasons, NULL,
- (const char * const *)p->reasons);
- ippAddInteger(history, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
- "printer-state-change-time", p->state_time);
- ippAddInteger(history, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
- "printer-state-sequence-number", p->sequence_number);
-
- p->history[p->num_history] = history;
- p->num_history ++;
-}
-
-
-/*
* 'cupsdCreateCommonData()' - Create the common printer data.
*/
@@ -880,14 +815,6 @@
if (p->printers != NULL)
free(p->printers);
- if (MaxPrinterHistory)
- {
- for (i = 0; i < p->num_history; i ++)
- ippDelete(p->history[i]);
-
- free(p->history);
- }
-
delete_printer_filters(p);
for (i = 0; i < p->num_reasons; i ++)
@@ -1059,7 +986,6 @@
*/
cupsdSetPrinterAttrs(p);
- cupsdAddPrinterHistory(p);
if (strncmp(p->device_uri, "file:", 5) &&
p->state != IPP_PRINTER_STOPPED)
@@ -2913,12 +2839,6 @@
p->state_message[0] = '\0';
/*
- * Update the printer history...
- */
-
- cupsdAddPrinterHistory(p);
-
- /*
* Let the browse protocols reflect the change...
*/
Index: scheduler/job.c
===================================================================
--- scheduler/job.c (revision 9586)
+++ scheduler/job.c (working copy)
@@ -4210,10 +4210,7 @@
return;
}
else if (cupsdSetPrinterReasons(job->printer, message))
- {
- cupsdAddPrinterHistory(job->printer);
event |= CUPSD_EVENT_PRINTER_STATE;
- }
update_job_attrs(job, 0);
}
@@ -4379,7 +4376,6 @@
{
strlcpy(job->printer->state_message, ptr,
sizeof(job->printer->state_message));
- cupsdAddPrinterHistory(job->printer);
event |= CUPSD_EVENT_PRINTER_STATE | CUPSD_EVENT_JOB_PROGRESS;
Index: scheduler/printers.h
===================================================================
--- scheduler/printers.h (revision 9586)
+++ scheduler/printers.h (working copy)
@@ -83,8 +83,6 @@
cups_array_t *quotas; /* Quota records */
int deny_users; /* 1 = deny, 0 = allow */
cups_array_t *users; /* Allowed/denied users */
- int num_history; /* Number of history collections */
- ipp_t **history; /* History data */
int sequence_number; /* Increasing sequence number */
int num_options; /* Number of default options */
cups_option_t *options; /* Default options */
@@ -138,7 +136,6 @@
*/
extern cupsd_printer_t *cupsdAddPrinter(const char *name);
-extern void cupsdAddPrinterHistory(cupsd_printer_t *p);
extern void cupsdCreateCommonData(void);
extern void cupsdDeleteAllPrinters(void);
extern int cupsdDeletePrinter(cupsd_printer_t *p, int update);
Index: scheduler/main.c
===================================================================
--- scheduler/main.c (revision 9586)
+++ scheduler/main.c (working copy)
@@ -1800,7 +1800,6 @@
{
strlcpy(job->printer->state_message, message,
sizeof(job->printer->state_message));
- cupsdAddPrinterHistory(job->printer);
}
if (!job->attrs)
_______________________________________________
cups-bugs mailing list
cups-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/cups-bugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic