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