diff options
author | David Disseldorp <ddiss@samba.org> | 2014-07-22 20:17:38 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-08-08 14:10:38 +0200 |
commit | e5e6e2c796f026ee6b04f99b327941d57b9bd026 (patch) | |
tree | 87fbf5e5ca105fec92f563ba54092a09e4eb7929 /source3/printing/pcap.c | |
parent | 4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38 (diff) | |
download | samba-e5e6e2c796f026ee6b04f99b327941d57b9bd026.tar.gz |
printing: reload printer_list.tdb from in memory list
This will allow in future for a single atomic printer_list.tdb update.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/printing/pcap.c')
-rw-r--r-- | source3/printing/pcap.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index 25dd4c70cde..0c4bf405545 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -83,7 +83,7 @@ void pcap_cache_destroy_specific(struct pcap_cache **pp_cache) *pp_cache = NULL; } -bool pcap_cache_add(const char *name, const char *comment, const char *location) +static bool pcap_cache_add(const char *name, const char *comment, const char *location) { NTSTATUS status; time_t t = time_mono(NULL); @@ -132,8 +132,8 @@ void pcap_cache_reload(struct tevent_context *ev, { const char *pcap_name = lp_printcapname(); bool pcap_reloaded = False; - NTSTATUS status; bool post_cache_fill_fn_handled = false; + struct pcap_cache *pcache = NULL; DEBUG(3, ("reloading printcap cache\n")); @@ -143,12 +143,6 @@ void pcap_cache_reload(struct tevent_context *ev, return; } - status = printer_list_mark_reload(); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("Failed to mark printer list for reload!\n")); - return; - } - #ifdef HAVE_CUPS if (strequal(pcap_name, "cups")) { pcap_reloaded = cups_cache_reload(ev, msg_ctx, @@ -164,26 +158,26 @@ void pcap_cache_reload(struct tevent_context *ev, #ifdef HAVE_IPRINT if (strequal(pcap_name, "iprint")) { - pcap_reloaded = iprint_cache_reload(); + pcap_reloaded = iprint_cache_reload(&pcache); goto done; } #endif #if defined(SYSV) || defined(HPUX) if (strequal(pcap_name, "lpstat")) { - pcap_reloaded = sysv_cache_reload(); + pcap_reloaded = sysv_cache_reload(&pcache); goto done; } #endif #ifdef AIX if (strstr_m(pcap_name, "/qconfig") != NULL) { - pcap_reloaded = aix_cache_reload(); + pcap_reloaded = aix_cache_reload(&pcache); goto done; } #endif - pcap_reloaded = std_pcap_cache_reload(pcap_name); + pcap_reloaded = std_pcap_cache_reload(pcap_name, &pcache); done: DEBUG(3, ("reload status: %s\n", (pcap_reloaded) ? "ok" : "error")); @@ -192,14 +186,16 @@ done: /* cleanup old entries only if the operation was successful, * otherwise keep around the old entries until we can * successfully reload */ - status = printer_list_clean_old(); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("Failed to cleanup printer list!\n")); + + if (!pcap_cache_replace(pcache)) { + DEBUG(0, ("Failed to replace printer list!\n")); } + if (post_cache_fill_fn != NULL) { post_cache_fill_fn(ev, msg_ctx); } } + pcap_cache_destroy_specific(&pcache); return; } |