* after purging a volume so that disk space will not be wasted. Only useful
* for File Storage, of course.
*
+ *
+ * It is currently disabled
*/
static bool action_on_purge_cmd(JCR *jcr)
{
- POOL_MEM devname;
- POOL_MEM volumename;
BSOCK *dir = jcr->dir_bsock;
- DEVICE *dev;
- DCR *dcr;
- int action;
- devname.check_size(dir->msglen+1);
- volumename.check_size(dir->msglen+1);
+ /* Currently disabled */
+ dir->fsend(_("3916 Feature action_on_purge currently disabled\n"));
+ goto done;
- if (sscanf(dir->msg, "action_on_purge %127s vol=%s action=%d",
- devname.c_str(), volumename.c_str(), &action) != 3) {
- dir->fsend(_("3916 Error scanning action_on_purge command\n"));
- goto done;
- }
- unbash_spaces(volumename.c_str());
- unbash_spaces(devname.c_str());
+#if 0
+ char devname[MAX_NAME_LENGTH];
+ char volumename[MAX_NAME_LENGTH];
+ int action;
- /* FIXME: autochanger, drive = 0? how can we avoid that? we only work on
- * files
- */
- if ((dcr = find_device(jcr, devname, 0)) == NULL) {
- dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str());
+ /* TODO: Need to find a free device and ask for slot to the director */
+ if (sscanf(dir->msg,
+ "action_on_purge %127s vol=%127s action=%d",
+ devname, volumename, &action)!= 5)
+ {
+ dir->fsend(_("3916 Error scanning action_on_purge command\n"));
goto done;
}
+ unbash_spaces(volumename);
+ unbash_spaces(devname);
- dev = dcr->dev;
-
- /* Store the VolumeName for opening and re-labeling the volume */
- bstrncpy(dcr->VolumeName, volumename.c_str(), sizeof(dcr->VolumeName));
- bstrncpy(dev->VolHdr.VolumeName, volumename.c_str(), sizeof(dev->VolHdr.VolumeName));
+ /* Check if action is correct */
+ if (action & AOP_TRUNCTATE) {
- /* Re-write the label with the recycle flag */
- if (rewrite_volume_label(dcr, true)) {
- dir->fsend(_("3917 Volume recycled\n"));
- } else {
- dir->fsend(_("3918 Recycle failed\n"));
- }
+ }
+ /* ... */
+#endif
done:
dir->signal(BNET_EOD);