mirror of
https://github.com/samba-team/samba.git
synced 2025-07-30 19:42:05 +03:00
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.
This commit is contained in:
@ -47,7 +47,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;
|
||||
|
@ -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;
|
||||
@ -807,7 +807,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')) {
|
||||
@ -897,7 +897,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);
|
||||
@ -958,7 +958,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';
|
||||
@ -1024,7 +1024,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);
|
||||
|
@ -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 :
|
||||
|
@ -1157,7 +1157,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 :
|
||||
|
@ -877,7 +877,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 */
|
||||
|
||||
@ -887,7 +887,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;
|
||||
@ -942,7 +942,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;i<ts->qcount;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;
|
||||
}
|
||||
@ -1043,7 +1043,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;
|
||||
@ -1194,7 +1194,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,
|
||||
@ -1214,7 +1214,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,
|
||||
@ -1410,7 +1410,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 */
|
||||
|
||||
@ -2974,7 +2974,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;
|
||||
@ -2998,7 +2998,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;
|
||||
@ -3016,7 +3016,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;
|
||||
}
|
||||
@ -3037,7 +3037,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;
|
||||
@ -3239,11 +3239,11 @@ WERROR print_queue_purge(const struct auth_session_info *server_info,
|
||||
|
||||
for (i=0;i<njobs;i++) {
|
||||
bool owner = is_owner(server_info, lp_const_servicename(snum),
|
||||
queue[i].job);
|
||||
queue[i].sysjob);
|
||||
|
||||
if (owner || can_job_admin) {
|
||||
print_job_delete1(server_event_context(), msg_ctx,
|
||||
snum, queue[i].job);
|
||||
snum, queue[i].sysjob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3228,7 +3228,7 @@ static void spoolss_notify_job_position(struct messaging_context *msg_ctx,
|
||||
struct spoolss_PrinterInfo2 *pinfo2,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SETUP_SPOOLSS_NOTIFY_DATA_INTEGER(data, queue->job);
|
||||
SETUP_SPOOLSS_NOTIFY_DATA_INTEGER(data, queue->sysjob);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@ -3694,7 +3694,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);
|
||||
}
|
||||
|
||||
@ -6975,7 +6975,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);
|
||||
@ -7016,7 +7016,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);
|
||||
@ -7069,10 +7069,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;
|
||||
|
||||
@ -9253,7 +9253,7 @@ static WERROR getjob_level_1(TALLOC_CTX *mem_ctx,
|
||||
bool found = false;
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (queue[i].job == (int)jobid) {
|
||||
if (queue[i].sysjob == (int)jobid) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -9288,7 +9288,7 @@ static WERROR getjob_level_2(TALLOC_CTX *mem_ctx,
|
||||
WERROR result;
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (queue[i].job == (int)jobid) {
|
||||
if (queue[i].sysjob == (int)jobid) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user