svn commit: samba r2085 - in trunk/source/printing: .
vlendec at samba.org
vlendec at samba.org
Fri Aug 27 11:14:23 GMT 2004
Author: vlendec
Date: 2004-08-27 11:14:23 +0000 (Fri, 27 Aug 2004)
New Revision: 2085
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source/printing&rev=2085&nolog=1
Log:
Convert more of printing.c from snum to sharename. Now we have enough
converted to be able to send only the sharename to the background daemon.
Volker
Modified:
trunk/source/printing/printfsp.c
trunk/source/printing/printing.c
Changeset:
Modified: trunk/source/printing/printfsp.c
===================================================================
--- trunk/source/printing/printfsp.c 2004-08-27 01:16:30 UTC (rev 2084)
+++ trunk/source/printing/printfsp.c 2004-08-27 11:14:23 UTC (rev 2085)
@@ -56,7 +56,8 @@
fsp->rap_print_jobid = pjobid_to_rap(SNUM(conn), jobid);
if (fsp->rap_print_jobid == 0) {
/* We need to delete the entry in the tdb. */
- pjob_delete(SNUM(conn), jobid);
+ pjob_delete(SNUM(conn, lp_const_servicename(SNUM(conn)),
+ jobid);
file_free(fsp);
return NULL;
}
Modified: trunk/source/printing/printing.c
===================================================================
--- trunk/source/printing/printing.c 2004-08-27 01:16:30 UTC (rev 2084)
+++ trunk/source/printing/printing.c 2004-08-27 11:14:23 UTC (rev 2085)
@@ -575,12 +575,11 @@
Remove a job structure from the database.
****************************************************************************/
-void pjob_delete(int snum, uint32 jobid)
+void pjob_delete(int snum, const char *sharename, uint32 jobid)
{
- struct printjob *pjob = print_job_find(lp_const_servicename(snum),
- jobid);
+ struct printjob *pjob = print_job_find(sharename, jobid);
uint32 job_status = 0;
- struct tdb_print_db *pdb = get_print_db_byname(lp_const_servicename(snum));
+ struct tdb_print_db *pdb = get_print_db_byname(sharename);
if (!pdb)
return;
@@ -601,10 +600,10 @@
properly. */
job_status |= JOB_STATUS_DELETING;
- notify_job_status(snum, jobid, job_status);
+ notify_job_status_byname(sharename, jobid, job_status, 0);
job_status |= JOB_STATUS_DELETED;
- notify_job_status(snum, jobid, job_status);
+ notify_job_status_byname(sharename, jobid, job_status, 0);
/* Remove from printing.tdb */
@@ -675,6 +674,7 @@
struct traverse_struct {
print_queue_struct *queue;
int qcount, snum, maxcount, total_jobs;
+ const char *sharename;
time_t lpq_time;
};
@@ -698,11 +698,6 @@
free_nt_devicemode( &pjob.nt_devmode );
- if (ts->snum != lp_servicenumber(pjob.queuename)) {
- /* this isn't for the queue we are looking at - this cannot happen with the split tdb's. JRA */
- return 0;
- }
-
if (!pjob.smbjob) {
/* remove a unix job if it isn't in the system queue any more */
@@ -714,7 +709,7 @@
if (i == ts->qcount) {
DEBUG(10,("traverse_fn_delete: pjob %u deleted due to !smbjob\n",
(unsigned int)jobid ));
- pjob_delete(ts->snum, jobid);
+ pjob_delete(ts->snum, ts->sharename, jobid);
return 0;
}
@@ -730,7 +725,7 @@
if (!process_exists(pjob.pid)) {
DEBUG(10,("traverse_fn_delete: pjob %u deleted due to !process_exists (%u)\n",
(unsigned int)jobid, (unsigned int)pjob.pid ));
- pjob_delete(ts->snum, jobid);
+ pjob_delete(ts->snum, ts->sharename, jobid);
} else
ts->total_jobs++;
return 0;
@@ -763,7 +758,7 @@
(unsigned int)jobid,
(unsigned int)pjob.starttime,
(unsigned int)ts->lpq_time ));
- pjob_delete(ts->snum, jobid);
+ pjob_delete(ts->snum, ts->sharename, jobid);
} else
ts->total_jobs++;
return 0;
@@ -984,7 +979,6 @@
}
struct print_queue_update_context {
- int snum; /* This can not be relied upon, to be removed */
fstring printer_name;
enum printing_types printing_type;
fstring lpqcommand;
@@ -1134,7 +1128,8 @@
system queue */
tstruct.queue = queue;
tstruct.qcount = qcount;
- tstruct.snum = ctx->snum;
+ tstruct.snum = -1;
+ tstruct.sharename = ctx->printer_name;
tstruct.total_jobs = 0;
tstruct.lpq_time = time(NULL);
@@ -1259,7 +1254,6 @@
{
struct print_queue_update_context ctx;
- ctx.snum = snum;
fstrcpy(ctx.printer_name, lp_const_servicename(snum));
ctx.printing_type = lp_printing(snum);
fstrcpy(ctx.lpqcommand, lp_lpqcommand(snum));
@@ -1653,7 +1647,7 @@
if (!pdb)
return False;
- pjob_delete(snum, jobid);
+ pjob_delete(snum, printername, jobid);
/* Ensure we keep a rough count of the number of total jobs... */
tdb_change_int32_atomic(pdb->tdb, "INFO/total_jobs", &njobs, -1);
release_print_db(pdb);
@@ -2177,7 +2171,7 @@
fail:
if (jobid != -1)
- pjob_delete(snum, jobid);
+ pjob_delete(snum, lp_const_servicename(snum), jobid);
release_print_db(pdb);
@@ -2247,7 +2241,7 @@
DEBUG(5,("print_job_end: canceling spool of %s (%s)\n",
pjob->filename, pjob->size ? "deleted" : "zero length" ));
unlink(pjob->filename);
- pjob_delete(snum, jobid);
+ pjob_delete(snum, lp_const_servicename(snum), jobid);
return True;
}
@@ -2275,7 +2269,7 @@
/* The print job was not succesfully started. Cleanup */
/* Still need to add proper error return propagation! 010122:JRR */
unlink(pjob->filename);
- pjob_delete(snum, jobid);
+ pjob_delete(snum, lp_const_servicename(snum), jobid);
remove_from_jobs_changed(lp_const_servicename(snum), jobid);
return False;
}
More information about the samba-cvs
mailing list