src/dird/ua_label.c
static void send_volume_info(UAContext *ua, char type, int Slot, char *vol_name)
{
   char ed1[50], ed2[50], ed3[50];
   POOL_DBR pr;
   MEDIA_DBR mr;
   /* Type|Slot|RealSlot|Volume|Bytes|Status|MediaType|Pool|LastW|Expire */
   const char *slot_api_full_format="%c|%i|%i|%s|%s|%s|%s|%s|%s|%s\n";
   const char *slot_api_empty_format="%c|%i||||||||\n";

   if (is_volume_name_legal(NULL, vol_name)) {
      bstrncpy(mr.VolumeName, vol_name, sizeof(mr.VolumeName));
      if (db_get_media_record(ua->jcr, ua->db, &mr)) {
         memset(&pr, 0, sizeof(POOL_DBR));
         pr.PoolId = mr.PoolId;
         if (!db_get_pool_record(ua->jcr, ua->db, &pr)) {
            strcpy(pr.Name, "?");
         }
         ua->send_msg(slot_api_full_format, type,
                      Slot, mr.Slot, mr.VolumeName,
                      edit_uint64(mr.VolBytes, ed1),
                      mr.VolStatus, mr.MediaType, pr.Name,
                      edit_uint64(mr.LastWritten, ed2),
                      edit_uint64(mr.LastWritten+mr.VolRetention, ed3));

      } else {                  /* Media unknown */
         ua->send_msg(slot_api_full_format,
                      type, Slot, 0, mr.VolumeName, "?", "?", "?", "?",
                      "0", "0");

      }
   } else {
      ua->send_msg(slot_api_empty_format, type, Slot);
   }
}
/*
 * Send Volume info to caller in API format
 */
Send Volume info to caller in API format
Send Volume info to caller in API format
static void send_volume_info(UAContext *ua, char type, int Slot, char *vol_name)
{
   char ed1[50], ed2[50], ed3[50];
   POOL_DBR pr;
   MEDIA_DBR mr;
   const char *slot_api_full_format="%c|%i|%i|%s|%s|%s|%s|%s|%s|%s\n";
   const char *slot_api_empty_format="%c|%i||||||||\n";
   if (is_volume_name_legal(NULL, vol_name)) {
      bstrncpy(mr.VolumeName, vol_name, sizeof(mr.VolumeName));
      if (db_get_media_record(ua->jcr, ua->db, &mr)) {
         memset(&pr, 0, sizeof(POOL_DBR));
         pr.PoolId = mr.PoolId;
         if (!db_get_pool_record(ua->jcr, ua->db, &pr)) {
            strcpy(pr.Name, "?");
         }
         ua->send_msg(slot_api_full_format, type,
                      Slot, mr.Slot, mr.VolumeName,
                      edit_uint64(mr.VolBytes, ed1),
                      mr.VolStatus, mr.MediaType, pr.Name,
                      edit_uint64(mr.LastWritten, ed2),
                      edit_uint64(mr.LastWritten+mr.VolRetention, ed3));
      } else {                  
         ua->send_msg(slot_api_full_format,
                      type, Slot, 0, mr.VolumeName, "?", "?", "?", "?",
                      "0", "0");
      }
   } else {
      ua->send_msg(slot_api_empty_format, type, Slot);
   }
}
static void send_volume_info ( UAContext * ua , char type , int Slot , char * vol_name ) { char ed1 [ 50 ] , ed2 [ 50 ] , ed3 [ 50 ] ; POOL_DBR pr ; MEDIA_DBR mr ; const char * slot_api_full_format = " \n " ; const char * slot_api_empty_format = " \n " ; if ( is_volume_name_legal ( NULL , vol_name ) ) { bstrncpy ( mr . VolumeName , vol_name , sizeof ( mr . VolumeName ) ) ; if ( db_get_media_record ( ua -> jcr , ua -> db , & mr ) ) { memset ( & pr , 0 , sizeof ( POOL_DBR ) ) ; pr . PoolId = mr . PoolId ; if ( ! db_get_pool_record ( ua -> jcr , ua -> db , & pr ) ) { strcpy ( pr . Name , " " ) ; } ua -> send_msg ( slot_api_full_format , type , Slot , mr . Slot , mr . VolumeName , edit_uint64 ( mr . VolBytes , ed1 ) , mr . VolStatus , mr . MediaType , pr . Name , edit_uint64 ( mr . LastWritten , ed2 ) , edit_uint64 ( mr . LastWritten + mr . VolRetention , ed3 ) ) ; } else { ua -> send_msg ( slot_api_full_format , type , Slot , 0 , mr . VolumeName , " " , " " , " " , " " , " " , " " ) ; } } else { ua -> send_msg ( slot_api_empty_format , type , Slot ) ; } }
Send Volume info to caller in API format
Send Volume info to caller in API format
/* Type|Slot|RealSlot|Volume|Bytes|Status|MediaType|Pool|LastW|Expire */ /* Media unknown */