]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/stored/job.c
c4510f1850cc371f24a33a2f8e88a24be86839d2
[bacula/bacula] / bacula / src / stored / job.c
1 /*
2  *   Job control and execution for Storage Daemon
3  *
4  *   Kern Sibbald, MM
5  *
6  *   Version $Id$
7  *
8  */
9 /*
10    Copyright (C) 2000-2005 Kern Sibbald
11
12    This program is free software; you can redistribute it and/or
13    modify it under the terms of the GNU General Public License as
14    published by the Free Software Foundation; either version 2 of
15    the License, or (at your option) any later version.
16
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20    General Public License for more details.
21
22    You should have received a copy of the GNU General Public
23    License along with this program; if not, write to the Free
24    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25    MA 02111-1307, USA.
26
27  */
28
29 #include "bacula.h"
30 #include "stored.h"
31
32 /* Imported variables */
33 extern uint32_t VolSessionTime;
34
35 /* Imported functions */
36 extern uint32_t newVolSessionId();
37
38 /* Forward referenced functions */
39 static bool use_storage_cmd(JCR *jcr);
40
41 /* Requests from the Director daemon */
42 static char jobcmd[] = "JobId=%d job=%127s job_name=%127s client_name=%127s "
43       "type=%d level=%d FileSet=%127s NoAttr=%d SpoolAttr=%d FileSetMD5=%127s "
44       "SpoolData=%d WritePartAfterJob=%d NewVol=%d\n";
45 static char use_storage[]  = "use storage=%127s media_type=%127s "
46    "pool_name=%127s pool_type=%127s append=%d copy=%d stripe=%d\n";
47 static char use_device[]  = "use device=%127s\n";
48 //static char query_device[] = "query device=%127s";
49
50
51 /* Responses sent to Director daemon */
52 static char OKjob[]     = "3000 OK Job SDid=%u SDtime=%u Authorization=%s\n";
53 static char OK_device[] = "3000 OK use device device=%s\n";
54 static char NO_device[] = "3924 Device \"%s\" not in SD Device resources.\n";
55 static char NOT_open[]  = "3925 Device \"%s\" could not be opened or does not exist.\n";
56 static char BAD_use[]   = "3913 Bad use command: %s\n";
57 static char BAD_job[]   = "3915 Bad Job command: %s\n";
58 //static char OK_query[]  = "3001 OK query\n";
59 //static char NO_query[]  = "3918 Query failed\n";
60 //static char BAD_query[] = "3917 Bad query command: %s\n";
61
62 /*
63  * Director requests us to start a job
64  * Basic tasks done here:
65  *  - We pickup the JobId to be run from the Director.
66  *  - We pickup the device, media, and pool from the Director
67  *  - Wait for a connection from the File Daemon (FD)
68  *  - Accept commands from the FD (i.e. run the job)
69  *  - Return when the connection is terminated or
70  *    there is an error.
71  */
72 bool job_cmd(JCR *jcr)
73 {
74    int JobId;
75    char auth_key[100];
76    BSOCK *dir = jcr->dir_bsock;
77    POOL_MEM job_name, client_name, job, fileset_name, fileset_md5;
78    int JobType, level, spool_attributes, no_attributes, spool_data;
79    int write_part_after_job, NewVol;
80
81    JCR *ojcr;
82
83    /*
84     * Get JobId and permissions from Director
85     */
86    Dmsg1(100, "<dird: %s\n", dir->msg);
87    if (sscanf(dir->msg, jobcmd, &JobId, job.c_str(), job_name.c_str(),
88               client_name.c_str(),
89               &JobType, &level, fileset_name.c_str(), &no_attributes,
90               &spool_attributes, fileset_md5.c_str(), &spool_data, 
91               &write_part_after_job, &NewVol) != 13) {
92       pm_strcpy(jcr->errmsg, dir->msg);
93       bnet_fsend(dir, BAD_job, jcr->errmsg);
94       Dmsg1(100, ">dird: %s\n", dir->msg);
95       Emsg1(M_FATAL, 0, _("Bad Job Command from Director: %s\n"), jcr->errmsg);
96       set_jcr_job_status(jcr, JS_ErrorTerminated);
97       return false;
98    }
99    /*
100     * Since this job could be rescheduled, we
101     *  check to see if we have it already. If so
102     *  free the old jcr and use the new one.
103     */
104    ojcr = get_jcr_by_full_name(job.c_str());
105    if (ojcr && !ojcr->authenticated) {
106       Dmsg2(100, "Found ojcr=0x%x Job %s\n", (unsigned)(long)ojcr, job.c_str());
107       free_jcr(ojcr);
108    }
109    jcr->JobId = JobId;
110    jcr->VolSessionId = newVolSessionId();
111    jcr->VolSessionTime = VolSessionTime;
112    bstrncpy(jcr->Job, job, sizeof(jcr->Job));
113    unbash_spaces(job_name);
114    jcr->job_name = get_pool_memory(PM_NAME);
115    pm_strcpy(jcr->job_name, job_name);
116    unbash_spaces(client_name);
117    jcr->client_name = get_pool_memory(PM_NAME);
118    pm_strcpy(jcr->client_name, client_name);
119    unbash_spaces(fileset_name);
120    jcr->fileset_name = get_pool_memory(PM_NAME);
121    pm_strcpy(jcr->fileset_name, fileset_name);
122    jcr->JobType = JobType;
123    jcr->JobLevel = level;
124    jcr->no_attributes = no_attributes;
125    jcr->spool_attributes = spool_attributes;
126    jcr->spool_data = spool_data;
127    jcr->write_part_after_job = write_part_after_job;
128    jcr->fileset_md5 = get_pool_memory(PM_NAME);
129    pm_strcpy(jcr->fileset_md5, fileset_md5);
130    jcr->NewVolEachJob = NewVol;
131
132    jcr->authenticated = false;
133
134    /*
135     * Pass back an authorization key for the File daemon
136     */
137    make_session_key(auth_key, NULL, 1);
138    bnet_fsend(dir, OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
139    Dmsg1(100, ">dird: %s", dir->msg);
140    jcr->sd_auth_key = bstrdup(auth_key);
141    memset(auth_key, 0, sizeof(auth_key));
142    generate_daemon_event(jcr, "JobStart");
143    return true;
144 }
145
146 bool use_cmd(JCR *jcr) 
147 {
148    /*
149     * Wait for the device, media, and pool information
150     */
151    if (!use_storage_cmd(jcr)) {
152       set_jcr_job_status(jcr, JS_ErrorTerminated);
153       memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
154       return false;
155    }
156    return true;
157 }
158
159 bool run_cmd(JCR *jcr)
160 {
161    struct timeval tv;
162    struct timezone tz;
163    struct timespec timeout;
164    int errstat;
165
166    Dmsg1(100, "Run_cmd: %s\n", jcr->dir_bsock->msg);
167    /* The following jobs don't need the FD */
168    switch (jcr->JobType) {
169    case JT_MIGRATION:
170    case JT_COPY:
171    case JT_ARCHIVE:
172       jcr->authenticated = true;
173       run_job(jcr);
174       return false;
175    }
176
177    set_jcr_job_status(jcr, JS_WaitFD);          /* wait for FD to connect */
178    dir_send_job_status(jcr);
179
180    gettimeofday(&tv, &tz);
181    timeout.tv_nsec = tv.tv_usec * 1000;
182    timeout.tv_sec = tv.tv_sec + 30 * 60;        /* wait 30 minutes */
183
184    Dmsg1(100, "%s waiting on FD to contact SD\n", jcr->Job);
185    /*
186     * Wait for the File daemon to contact us to start the Job,
187     *  when he does, we will be released, unless the 30 minutes
188     *  expires.
189     */
190    P(jcr->mutex);
191    for ( ;!job_canceled(jcr); ) {
192       errstat = pthread_cond_timedwait(&jcr->job_start_wait, &jcr->mutex, &timeout);
193       if (errstat == 0 || errstat == ETIMEDOUT) {
194          break;
195       }
196    }
197    V(jcr->mutex);
198
199    memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
200
201    if (jcr->authenticated && !job_canceled(jcr)) {
202       Dmsg1(100, "Running job %s\n", jcr->Job);
203       run_job(jcr);                   /* Run the job */
204    }
205    return false;
206 }
207
208 /*
209  * After receiving a connection (in job.c) if it is
210  *   from the File daemon, this routine is called.
211  */
212 void handle_filed_connection(BSOCK *fd, char *job_name)
213 {
214    JCR *jcr;
215
216    bmicrosleep(0, 50000);             /* wait 50 millisecs */
217    if (!(jcr=get_jcr_by_full_name(job_name))) {
218       Jmsg1(NULL, M_FATAL, 0, _("Job name not found: %s\n"), job_name);
219       Dmsg1(100, "Job name not found: %s\n", job_name);
220       return;
221    }
222
223    jcr->file_bsock = fd;
224    jcr->file_bsock->jcr = jcr;
225
226    Dmsg1(110, "Found Job %s\n", job_name);
227
228    if (jcr->authenticated) {
229       Jmsg2(jcr, M_FATAL, 0, "Hey!!!! JobId %u Job %s already authenticated.\n",
230          jcr->JobId, jcr->Job);
231       free_jcr(jcr);
232       return;
233    }
234
235    /*
236     * Authenticate the File daemon
237     */
238    if (jcr->authenticated || !authenticate_filed(jcr)) {
239       Dmsg1(100, "Authentication failed Job %s\n", jcr->Job);
240       Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
241    } else {
242       jcr->authenticated = true;
243       Dmsg1(110, "OK Authentication Job %s\n", jcr->Job);
244    }
245
246    P(jcr->mutex);
247    if (!jcr->authenticated) {
248       set_jcr_job_status(jcr, JS_ErrorTerminated);
249    }
250    pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
251    V(jcr->mutex);
252    free_jcr(jcr);
253    return;
254 }
255
256
257 /*
258  *   Use Device command from Director
259  *   He tells is what Device Name to use, the Media Type,
260  *      the Pool Name, and the Pool Type.
261  *
262  *    Ensure that the device exists and is opened, then store
263  *      the media and pool info in the JCR.
264  */
265 class DIRSTORE {
266 public:
267    alist *device;
268    char name[MAX_NAME_LENGTH];
269    char media_type[MAX_NAME_LENGTH];
270    char pool_name[MAX_NAME_LENGTH];
271    char pool_type[MAX_NAME_LENGTH];
272 };
273
274 static int search_res_for_device(JCR *jcr, DIRSTORE *store, char *device_name, int append);
275
276 static bool use_storage_cmd(JCR *jcr)
277 {
278    POOL_MEM store_name, dev_name, media_type, pool_name, pool_type;
279    BSOCK *dir = jcr->dir_bsock;
280    int append;
281    bool ok;       
282    int Copy, Stripe;
283    alist *dirstore;   
284    DIRSTORE *store;
285    char *device_name;
286    DCR *dcr = NULL;
287    /*
288     * If there are multiple devices, the director sends us
289     *   use_device for each device that it wants to use.
290     */
291    Dmsg1(100, "<dird: %s", dir->msg);
292    dirstore = New(alist(10, not_owned_by_alist));
293    do {
294       ok = sscanf(dir->msg, use_storage, store_name.c_str(), 
295                   media_type.c_str(), pool_name.c_str(), 
296                   pool_type.c_str(), &append, &Copy, &Stripe) == 7;
297       if (!ok) {
298          break;
299       }
300       unbash_spaces(store_name);
301       unbash_spaces(media_type);
302       unbash_spaces(pool_name);
303       unbash_spaces(pool_type);
304       store = new DIRSTORE;
305       dirstore->append(store);
306       memset(store, 0, sizeof(DIRSTORE));
307       store->device = New(alist(10));
308       bstrncpy(store->name, store_name, sizeof(store->name));
309       bstrncpy(store->media_type, media_type, sizeof(store->media_type));
310       bstrncpy(store->pool_name, pool_name, sizeof(store->pool_name));
311       bstrncpy(store->pool_type, pool_type, sizeof(store->pool_type));
312
313       /* Now get all devices */
314       while (bnet_recv(dir) >= 0) {
315          ok = sscanf(dir->msg, use_device, dev_name.c_str()) == 1;
316          if (!ok) {
317             break;
318          }
319          unbash_spaces(dev_name);
320          store->device->append(bstrdup(dev_name.c_str()));
321       }
322    }  while (ok && bnet_recv(dir) >= 0);
323
324 #ifdef DEVELOPER
325    /* This loop is debug code and can be removed */
326    /* ***FIXME**** remove after 1.38 release */
327    foreach_alist(store, dirstore) {
328       Dmsg4(100, "Storage=%s media_type=%s pool=%s pool_type=%s\n", 
329          store->name, store->media_type, store->pool_name, 
330          store->pool_type);
331       foreach_alist(device_name, store->device) {
332          Dmsg1(100, "   Device=%s\n", device_name);
333       }
334    }
335 #endif
336
337    /*                    
338     * At this point, we have a list of all the Director's Storage
339     *  resources indicated for this Job, which include Pool, PoolType,
340     *  storage name, and Media type.     
341     * Then for each of the Storage resources, we have a list of
342     *  device names that were given.
343     *
344     * Wiffle through them and find one that can do the backup.
345     */
346    if (ok) {
347       store = (DIRSTORE *)dirstore->first();
348       foreach_alist(device_name, store->device) {
349          if (search_res_for_device(jcr, store, device_name, append) == 1) {
350             dcr = jcr->dcr;
351             dcr->Copy = Copy;
352             dcr->Stripe = Stripe;
353             ok = true;
354             goto done;
355          }
356       }
357       if (verbose) {
358          unbash_spaces(dir->msg);
359          pm_strcpy(jcr->errmsg, dir->msg);
360          Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), jcr->errmsg);
361       }
362       Jmsg(jcr, M_FATAL, 0, _("\n"
363          "     Device \"%s\" with MediaType \"%s\" requested by DIR not found in SD Device resources.\n"),
364            dev_name.c_str(), media_type.c_str());
365       bnet_fsend(dir, NO_device, dev_name.c_str());
366       Dmsg1(100, ">dird: %s\n", dir->msg);
367       ok = false;
368    } else {
369       unbash_spaces(dir->msg);
370       pm_strcpy(jcr->errmsg, dir->msg);
371       if (verbose) {
372          Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), jcr->errmsg);
373       }
374       Jmsg(jcr, M_FATAL, 0, _("Bad Use Device command: %s\n"), jcr->errmsg);
375       bnet_fsend(dir, BAD_use, jcr->errmsg);
376       Dmsg1(100, ">dird: %s\n", dir->msg);
377       ok = false;
378    }
379
380 done:
381    foreach_alist(store, dirstore) {
382       delete store->device;
383       delete store;
384    }
385    delete dirstore;
386    if (!ok && dcr) {
387       free_dcr(dcr);
388    }
389    return ok;
390 }
391
392 /*
393  *  Returns: 1 -- OK, have DCR
394  *           0 -- must wait
395  *          -1 -- fatal error
396  */
397 static int search_res_for_device(JCR *jcr, DIRSTORE *store, char *device_name, int append)
398 {
399    DEVRES *device;
400    AUTOCHANGER *changer;
401    BSOCK *dir = jcr->dir_bsock;
402    bool ok;
403    DCR *dcr;
404
405    Dmsg1(100, "Search res for %s\n", device_name);
406    foreach_res(device, R_DEVICE) {
407       Dmsg1(100, "Try res=%s\n", device->hdr.name);
408       /* Find resource, and make sure we were able to open it */
409       if (fnmatch(device_name, device->hdr.name, 0) == 0 &&
410           strcmp(device->media_type, store->media_type) == 0) {
411          const int name_len = MAX_NAME_LENGTH;
412          if (!device->dev) {
413             device->dev = init_dev(jcr, NULL, device);
414          }
415          if (!device->dev) {
416             Jmsg(jcr, M_WARNING, 0, _("\n"
417                "     Device \"%s\" requested by DIR could not be opened or does not exist.\n"),
418                  device_name);
419             bnet_fsend(dir, NOT_open, device_name);
420             Dmsg1(100, ">dird: %s\n", dir->msg);
421             return -1;
422          }  
423          Dmsg1(100, "Found device %s\n", device->hdr.name);
424          dcr = new_dcr(jcr, device->dev);
425          if (!dcr) {
426             bnet_fsend(dir, _("3926 Could not get dcr for device: %s\n"), device_name);
427             Dmsg1(100, ">dird: %s\n", dir->msg);
428             return -1;
429          }
430          jcr->dcr = dcr;
431          bstrncpy(dcr->pool_name, store->pool_name, name_len);
432          bstrncpy(dcr->pool_type, store->pool_type, name_len);
433          bstrncpy(dcr->media_type, store->media_type, name_len);
434          bstrncpy(dcr->dev_name, device_name, name_len);
435          if (append == SD_APPEND) {
436             ok = reserve_device_for_append(dcr);
437          } else {
438             ok = reserve_device_for_read(dcr);
439          }
440          if (!ok) {
441             bnet_fsend(dir, _("3927 Could not reserve device: %s\n"), device_name);
442             Dmsg1(100, ">dird: %s\n", dir->msg);
443             free_dcr(jcr->dcr);
444             return 0;
445          }
446          Dmsg1(220, "Got: %s", dir->msg);
447          bash_spaces(device_name);
448          ok = bnet_fsend(dir, OK_device, device_name);
449          Dmsg1(100, ">dird: %s\n", dir->msg);
450          return ok;
451       }
452    }
453    foreach_res(changer, R_AUTOCHANGER) {
454       Dmsg1(100, "Try changer res=%s\n", changer->hdr.name);
455       /* Find resource, and make sure we were able to open it */
456       if (fnmatch(device_name, changer->hdr.name, 0) == 0) {
457          const int name_len = MAX_NAME_LENGTH;
458          /* Try each device in this AutoChanger */
459          foreach_alist(device, changer->device) {
460             Dmsg1(100, "Try changer device %s\n", device->hdr.name);
461             if (!device->dev) {
462                device->dev = init_dev(jcr, NULL, device);
463             }
464             if (!device->dev) {
465                Dmsg1(100, "Device %s could not be opened. Skipped\n", device_name);
466                Jmsg(jcr, M_WARNING, 0, _("\n"
467                   "     Device \"%s\" in changer \"%s\" requested by DIR could not be opened or does not exist.\n"),
468                     device->hdr.name, device_name);
469                continue;
470             }
471             if (!device->dev->autoselect) {
472                continue;           /* device is not available */
473             }
474             dcr = new_dcr(jcr, device->dev);
475             if (!dcr) {
476                bnet_fsend(dir, _("3926 Could not get dcr for device: %s\n"), device_name);
477                Dmsg1(100, ">dird: %s\n", dir->msg);
478                return -1;
479             }
480             Dmsg1(100, "Found changer device %s\n", device->hdr.name);
481             bstrncpy(dcr->pool_name, store->pool_name, name_len);
482             bstrncpy(dcr->pool_type, store->pool_type, name_len);
483             bstrncpy(dcr->media_type, store->media_type, name_len);
484             bstrncpy(dcr->dev_name, device_name, name_len);
485             jcr->dcr = dcr;
486             if (append == SD_APPEND) {
487                ok = reserve_device_for_append(dcr);
488             } else {
489                ok = reserve_device_for_read(dcr);
490             }
491             if (!ok) {
492                Jmsg(jcr, M_WARNING, 0, _("Could not reserve device: %s\n"), device_name);
493                free_dcr(jcr->dcr);
494                continue;
495             }
496             POOL_MEM dev_name;
497             Dmsg1(100, "Device %s opened.\n", device_name);
498             pm_strcpy(dev_name, device->hdr.name);
499             bash_spaces(dev_name);
500             ok = bnet_fsend(dir, OK_device, dev_name.c_str());  /* Return real device name */
501             Dmsg1(100, ">dird: %s\n", dir->msg);
502             return ok;
503          }
504       }
505    }
506    return 0;
507 }
508
509
510 #ifdef needed
511 /*
512  *   Query Device command from Director
513  *   Sends Storage Daemon's information on the device to the
514  *    caller (presumably the Director).
515  *   This command always returns "true" so that the line is
516  *    not closed on an error.
517  *
518  */
519 bool query_cmd(JCR *jcr)
520 {
521    POOL_MEM dev_name, VolumeName, MediaType, ChangerName;
522    BSOCK *dir = jcr->dir_bsock;
523    DEVRES *device;
524    AUTOCHANGER *changer;
525    bool ok;
526
527    Dmsg1(100, "Query_cmd: %s", dir->msg);
528    ok = sscanf(dir->msg, query_device, dev_name.c_str()) == 1;
529    Dmsg1(100, "<dird: %s\n", dir->msg);
530    if (ok) {
531       unbash_spaces(dev_name);
532 //    LockRes();
533       foreach_res(device, R_DEVICE) {
534          /* Find resource, and make sure we were able to open it */
535          if (fnmatch(dev_name.c_str(), device->hdr.name, 0) == 0) {
536             if (!device->dev) {
537                device->dev = init_dev(jcr, NULL, device);
538             }
539             if (!device->dev) {
540                break;
541             }  
542 //          UnlockRes();
543             ok = dir_update_device(jcr, device->dev);
544             if (ok) {
545                ok = bnet_fsend(dir, OK_query);
546             } else {
547                bnet_fsend(dir, NO_query);
548             }
549             return ok;
550          }
551       }
552       foreach_res(changer, R_AUTOCHANGER) {
553          /* Find resource, and make sure we were able to open it */
554          if (fnmatch(dev_name.c_str(), changer->hdr.name, 0) == 0) {
555 //          UnlockRes();
556             if (!changer->device || changer->device->size() == 0) {
557                continue;              /* no devices */
558             }
559             ok = dir_update_changer(jcr, changer);
560             if (ok) {
561                ok = bnet_fsend(dir, OK_query);
562             } else {
563                bnet_fsend(dir, NO_query);
564             }
565             return ok;
566          }
567       }
568       /* If we get here, the device/autochanger was not found */
569 //    UnlockRes();
570       unbash_spaces(dir->msg);
571       pm_strcpy(jcr->errmsg, dir->msg);
572       bnet_fsend(dir, NO_device, dev_name.c_str());
573       Dmsg1(100, ">dird: %s\n", dir->msg);
574    } else {
575       unbash_spaces(dir->msg);
576       pm_strcpy(jcr->errmsg, dir->msg);
577       bnet_fsend(dir, BAD_query, jcr->errmsg);
578       Dmsg1(100, ">dird: %s\n", dir->msg);
579    }
580
581    return true;
582 }
583
584 #endif
585
586
587 /*
588  * Destroy the Job Control Record and associated
589  * resources (sockets).
590  */
591 void stored_free_jcr(JCR *jcr)
592 {
593    if (jcr->file_bsock) {
594       bnet_close(jcr->file_bsock);
595       jcr->file_bsock = NULL;
596    }
597    if (jcr->job_name) {
598       free_pool_memory(jcr->job_name);
599    }
600    if (jcr->client_name) {
601       free_memory(jcr->client_name);
602       jcr->client_name = NULL;
603    }
604    if (jcr->fileset_name) {
605       free_memory(jcr->fileset_name);
606    }
607    if (jcr->fileset_md5) {
608       free_memory(jcr->fileset_md5);
609    }
610    if (jcr->bsr) {
611       free_bsr(jcr->bsr);
612       jcr->bsr = NULL;
613    }
614    if (jcr->RestoreBootstrap) {
615       unlink(jcr->RestoreBootstrap);
616       free_pool_memory(jcr->RestoreBootstrap);
617       jcr->RestoreBootstrap = NULL;
618    }
619    if (jcr->next_dev || jcr->prev_dev) {
620       Emsg0(M_FATAL, 0, _("In free_jcr(), but still attached to device!!!!\n"));
621    }
622    pthread_cond_destroy(&jcr->job_start_wait);
623    if (jcr->dcrs) {
624       delete jcr->dcrs;
625    }
626    jcr->dcrs = NULL;
627    if (jcr->dcr) {
628       free_dcr(jcr->dcr);
629       jcr->dcr = NULL;
630    }
631    return;
632 }