From: David Disseldorp Date: Fri, 27 Jan 2012 11:33:27 +0000 (+0100) Subject: s3-printing: rename queue->job sysjob X-Git-Url: http://git.samba.org/?p=ddiss%2Fsamba.git;a=commitdiff_plain;h=9270772d34b54fc974ac78eb78142ac34a7aa00f s3-printing: rename queue->job sysjob Print jobs maintain two job identifiers, the jobid allocated by the spoolss layer (pj->jobid), and the job identifier defined by the printing backend (pj->sysjob). Printer job queues currently only contain a single job identifier variable (queue->job), the variable is sometimes representative of the spoolss layer job identifier, and more often representative of the printing backend id. This change renames the queue job identifier from queue->job to queue->sysjob, in preparation for a change to only store the printing backend identifier. --- diff --git a/source3/include/printing.h b/source3/include/printing.h index 2d6925c2691..793a581c889 100644 --- a/source3/include/printing.h +++ b/source3/include/printing.h @@ -46,7 +46,7 @@ enum { }; typedef struct _print_queue_struct { - int job; /* normally the UNIX jobid -- see note in + int sysjob; /* normally the UNIX jobid -- see note in printing.c:traverse_fn_delete() */ int size; int page_count; diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index 16b9b09fef3..2a14dfa2ec6 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -164,7 +164,7 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first) return False; } - buf->job = atoi(tok[JOBTOK]); + buf->sysjob = atoi(tok[JOBTOK]); buf->size = atoi(tok[TOTALTOK]); buf->status = strequal(tok[RANKTOK],"active")?LPQ_PRINTING:LPQ_QUEUED; buf->time = time(NULL); @@ -281,7 +281,7 @@ static bool parse_lpq_lprng(char *line,print_queue_struct *buf,bool first) return False; } - buf->job = atoi(tokarr[LPRNG_JOBTOK]); + buf->sysjob = atoi(tokarr[LPRNG_JOBTOK]); buf->size = atoi(tokarr[LPRNG_TOTALTOK]); if (strequal(tokarr[LPRNG_RANKTOK],"active")) { @@ -384,7 +384,7 @@ static bool parse_lpq_aix(char *line,print_queue_struct *buf,bool first) } } - buf->job = atoi(tok[1]); + buf->sysjob = atoi(tok[1]); buf->status = strequal(tok[0],"HELD")?LPQ_PAUSED:LPQ_QUEUED; buf->priority = 0; buf->time = time(NULL); @@ -420,7 +420,7 @@ static bool parse_lpq_aix(char *line,print_queue_struct *buf,bool first) } } - buf->job = atoi(tok[3]); + buf->sysjob = atoi(tok[3]); buf->status = strequal(tok[2],"RUNNING")?LPQ_PRINTING:LPQ_QUEUED; buf->priority = 0; buf->time = time(NULL); @@ -511,7 +511,7 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) /* fill things from header line */ buf->time = jobtime; - buf->job = jobid; + buf->sysjob = jobid; buf->status = jobstat; buf->priority = jobprio; if (jobuser) { @@ -651,7 +651,7 @@ static bool parse_lpq_sysv(char *line,print_queue_struct *buf,bool first) tok[2] = p+1; } - buf->job = atoi(tok[1]); + buf->sysjob = atoi(tok[1]); buf->size = atoi(tok[3]); if (count > 7 && strequal(tok[7],"on")) { buf->status = LPQ_PRINTING; @@ -726,7 +726,7 @@ static bool parse_lpq_qnx(char *line,print_queue_struct *buf,bool first) } } - buf->job = atoi(tok[2]); + buf->sysjob = atoi(tok[2]); buf->size = atoi(tok[4]); buf->status = strequal(tok[3],"active")?LPQ_PRINTING:LPQ_QUEUED; buf->priority = 0; @@ -806,7 +806,7 @@ static bool parse_lpq_plp(char *line,print_queue_struct *buf,bool first) } } - buf->job = atoi(tok[4]); + buf->sysjob = atoi(tok[4]); buf->size = atoi(tok[7]); if (strchr_m(tok[7],'K')) { @@ -896,7 +896,7 @@ static bool parse_lpq_nt(char *line,print_queue_struct *buf,bool first) parse_line->space3 = '\0'; trim_char(parse_line->jobname, '\0', ' '); - buf->job = atoi(parse_line->jobid); + buf->sysjob = atoi(parse_line->jobid); buf->priority = 0; buf->size = atoi(parse_line->size); buf->time = time(NULL); @@ -957,7 +957,7 @@ static bool parse_lpq_os2(char *line,print_queue_struct *buf,bool first) } /* Get the jobid */ - buf->job = atoi(parse_line->jobid); + buf->sysjob = atoi(parse_line->jobid); /* Get the job name */ parse_line->space2[0] = '\0'; @@ -1023,7 +1023,7 @@ static bool parse_lpq_vlp(char *line,print_queue_struct *buf,bool first) while(next_token_talloc(frame, &cline, &tok, NULL)) { switch (toknum) { case 0: - buf->job = atoi(tok); + buf->sysjob = atoi(tok); break; case 1: buf->size = atoi(tok); diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index ed2cb388d58..8f0cd88d015 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -1243,7 +1243,7 @@ static int cups_queue_get(const char *sharename, continue; } - temp->job = job_id; + temp->sysjob = job_id; temp->size = job_k_octets * 1024; temp->status = job_status == IPP_JOB_PENDING ? LPQ_QUEUED : job_status == IPP_JOB_STOPPED ? LPQ_PAUSED : diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c index 1392cba7b8f..9e741c1091a 100644 --- a/source3/printing/print_iprint.c +++ b/source3/printing/print_iprint.c @@ -1162,7 +1162,7 @@ static int iprint_queue_get(const char *sharename, continue; } - temp->job = job_id; + temp->sysjob = job_id; temp->size = job_k_octets * 1024; temp->status = job_status == IPP_JOB_PENDING ? LPQ_QUEUED : job_status == IPP_JOB_STOPPED ? LPQ_PAUSED : diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 75fce1af121..d44405b93ee 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -870,7 +870,7 @@ static void print_unix_job(struct tevent_context *ev, struct printjob pj, *old_pj; if (jobid == (uint32)-1) - jobid = q->job + UNIX_JOB_START; + jobid = q->sysjob + UNIX_JOB_START; /* Preserve the timestamp on an existing unix print job */ @@ -880,7 +880,7 @@ static void print_unix_job(struct tevent_context *ev, pj.pid = (pid_t)-1; pj.jobid = jobid; - pj.sysjob = q->job; + pj.sysjob = q->sysjob; pj.fd = -1; pj.starttime = old_pj ? old_pj->starttime : q->time; pj.status = q->status; @@ -935,7 +935,7 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void /* remove a unix job if it isn't in the system queue any more */ for (i=0;iqcount;i++) { - uint32 u_jobid = (ts->queue[i].job + UNIX_JOB_START); + uint32 u_jobid = (ts->queue[i].sysjob + UNIX_JOB_START); if (jobid == u_jobid) break; } @@ -1036,7 +1036,7 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void FIXME!!! This is the only place where queue->job represents the SMB jobid --jerry */ - ts->queue[i].job = jobid; + ts->queue[i].sysjob = jobid; ts->queue[i].size = pjob.size; ts->queue[i].page_count = pjob.page_count; ts->queue[i].status = pjob.status; @@ -1187,7 +1187,7 @@ static void store_queue_struct(struct tdb_print_db *pdb, struct traverse_struct qcount++; data.dsize += tdb_pack(NULL, 0, "ddddddff", - (uint32)queue[i].job, + (uint32)queue[i].sysjob, (uint32)queue[i].size, (uint32)queue[i].page_count, (uint32)queue[i].status, @@ -1207,7 +1207,7 @@ static void store_queue_struct(struct tdb_print_db *pdb, struct traverse_struct continue; len += tdb_pack(data.dptr + len, data.dsize - len, "ddddddff", - (uint32)queue[i].job, + (uint32)queue[i].sysjob, (uint32)queue[i].size, (uint32)queue[i].page_count, (uint32)queue[i].status, @@ -1403,7 +1403,7 @@ static void print_queue_update_internal( struct tevent_context *ev, continue; } - pjob->sysjob = queue[i].job; + pjob->sysjob = queue[i].sysjob; /* don't reset the status on jobs to be deleted */ @@ -3080,7 +3080,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx, &qtime, queue[i].fs_user, queue[i].fs_file); - queue[i].job = qjob; + queue[i].sysjob = qjob; queue[i].size = qsize; queue[i].page_count = qpage_count; queue[i].status = qstatus; @@ -3104,7 +3104,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx, continue; } - queue[total_count].job = jobid; + queue[total_count].sysjob = jobid; queue[total_count].size = pjob->size; queue[total_count].page_count = pjob->page_count; queue[total_count].status = pjob->status; @@ -3122,7 +3122,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx, bool found = false; for (j = 0; j < total_count; j++) { - if (queue[j].job == jobid) { + if (queue[j].sysjob == jobid) { found = true; break; } @@ -3143,7 +3143,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx, continue; } - queue[j].job = jobid; + queue[j].sysjob = jobid; queue[j].size = pjob->size; queue[j].page_count = pjob->page_count; queue[j].status = pjob->status; @@ -3345,11 +3345,11 @@ WERROR print_queue_purge(const struct auth_serversupplied_info *server_info, for (i=0;ijob); + SETUP_SPOOLSS_NOTIFY_DATA_INTEGER(data, queue->sysjob); } /******************************************************************* @@ -3685,7 +3685,7 @@ static WERROR printer_notify_info(struct pipes_struct *p, &queue[j], info, pinfo2, snum, &option_type, - queue[j].job, + queue[j].sysjob, mem_ctx); } @@ -6783,7 +6783,7 @@ static WERROR fill_job_info1(TALLOC_CTX *mem_ctx, t = gmtime(&queue->time); - r->job_id = queue->job; + r->job_id = queue->sysjob; r->printer_name = talloc_strdup(mem_ctx, lp_servicename(snum)); W_ERROR_HAVE_NO_MEMORY(r->printer_name); @@ -6824,7 +6824,7 @@ static WERROR fill_job_info2(TALLOC_CTX *mem_ctx, t = gmtime(&queue->time); - r->job_id = queue->job; + r->job_id = queue->sysjob; r->printer_name = talloc_strdup(mem_ctx, lp_servicename(snum)); W_ERROR_HAVE_NO_MEMORY(r->printer_name); @@ -6877,10 +6877,10 @@ static WERROR fill_job_info3(TALLOC_CTX *mem_ctx, int position, int snum, struct spoolss_PrinterInfo2 *pinfo2) { - r->job_id = queue->job; + r->job_id = queue->sysjob; r->next_job_id = 0; if (next_queue) { - r->next_job_id = next_queue->job; + r->next_job_id = next_queue->sysjob; } r->reserved = 0; @@ -9028,7 +9028,7 @@ static WERROR getjob_level_1(TALLOC_CTX *mem_ctx, bool found = false; for (i=0; i