4 Unix SMB/Netbios implementation.
6 printing backend routines for smbd - using files_struct rather
8 Copyright (C) Andrew Tridgell 1992-2000
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 extern int DEBUGLEVEL;
29 /***************************************************************************
30 open a print file and setup a fsp for it. This is a wrapper around
32 ***************************************************************************/
34 files_struct *print_fsp_open(connection_struct *conn,char *jobname)
38 extern struct current_user current_user;
39 files_struct *fsp = file_new();
44 jobid = print_job_start(SNUM(conn), jobname);
50 /* setup a full fsp */
51 fsp->print_jobid = jobid;
52 fsp->fd = print_job_fd(jobid);
53 conn->vfs_ops.fstat(fsp->fd, &sbuf);
54 fsp->mode = sbuf.st_mode;
55 fsp->inode = sbuf.st_ino;
56 fsp->dev = sbuf.st_dev;
57 GetTimeOfDay(&fsp->open_time);
58 fsp->vuid = current_user.vuid;
62 fsp->can_read = False;
63 fsp->can_write = True;
65 fsp->print_file = True;
66 fsp->modified = False;
67 fsp->oplock_type = NO_OPLOCK;
68 fsp->sent_oplock_break = NO_BREAK_SENT;
69 fsp->is_directory = False;
70 fsp->stat_open = False;
71 fsp->directory_delete_on_close = False;
73 string_set(&fsp->fsp_name,print_job_fname(jobid));
74 fsp->wbmpx_ptr = NULL;
77 conn->num_files_open++;
82 /****************************************************************************
83 print a file - called on closing the file
84 ****************************************************************************/
85 void print_fsp_end(files_struct *fsp)
87 print_job_end(fsp->print_jobid);
90 string_free(&fsp->fsp_name);