~ubuntu-branches/ubuntu/trusty/xfsdump/trusty-proposed

« back to all changes in this revision

Viewing changes to common/drive_scsitape.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2008-04-23 22:06:34 UTC
  • mfrom: (0.1.1 upstream) (3.1.1 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080423220634-7m8953nknbpz1nsv
Tags: 2.2.48-1
* New upstream release
* xfsdump depends on ${misc:Depends}
* Add debian/watch
* Add homepage control header
* Fix the following lintian issues:
  W: xfsdump source: package-uses-deprecated-debhelper-compat-version 1
  W: xfsdump source: ancient-standards-version 3.5.9 (current is 3.7.3)

Show diffs side-by-side

added added

removed removed

Lines of Context:
609
609
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
610
610
                                mlog( MLOG_NORMAL | MLOG_WARNING | MLOG_DRIVE,
611
611
                                      _("-%c argument missing\n"),
612
 
                                      optopt );
 
612
                                      c );
613
613
                                return BOOL_FALSE;
614
614
                        }
615
615
                        contextp->dc_ringlen = ( size_t )atoi( optarg );
619
619
                                mlog( MLOG_NORMAL | MLOG_ERROR | MLOG_DRIVE,
620
620
                                      _("-%c argument must be "
621
621
                                      "between %u and %u: ignoring %u\n"),
622
 
                                      optopt,
 
622
                                      c,
623
623
                                      RINGLEN_MIN,
624
624
                                      RINGLEN_MAX,
625
625
                                      contextp->dc_ringlen );
642
642
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
643
643
                            mlog( MLOG_NORMAL | MLOG_WARNING | MLOG_DRIVE,
644
644
                                    _("-%c argument missing\n"),
645
 
                                    optopt );
 
645
                                    c );
646
646
                            return -10;
647
647
                        }
648
648
                        cmdlineblksize = ( u_int32_t )atoi( optarg );
655
655
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
656
656
                                mlog( MLOG_NORMAL | MLOG_WARNING | MLOG_DRIVE,
657
657
                                      _("-%c argument missing\n"),
658
 
                                      optopt );
 
658
                                      c );
659
659
                                return BOOL_FALSE;
660
660
                        }
661
661
                        /* given in Mb */
664
664
                                mlog( MLOG_NORMAL | MLOG_ERROR | MLOG_DRIVE,
665
665
                                      _("-%c argument must be a "
666
666
                                      "positive number (Mb): ignoring %u\n"),
667
 
                                      optopt,
 
667
                                      c,
668
668
                                      contextp->dc_filesz );
669
669
                                return BOOL_FALSE;
670
670
                        }
3818
3818
static bool_t
3819
3819
is_variable( drive_t *drivep, bool_t *varblk )
3820
3820
{
3821
 
        bool_t ok;
3822
 
        struct mtblkinfo minfo;
3823
3821
        drive_context_t *contextp;
3824
3822
 
3825
3823
        contextp = ( drive_context_t * )drivep->d_contextp;
3826
3824
 
3827
 
        ok = mt_blkinfo(contextp->dc_fd, &minfo);
3828
 
        if ( ! ok ) {
3829
 
                /* failure
3830
 
                 */
3831
 
                return BOOL_FALSE;
3832
 
        }
3833
 
 
3834
 
        /* for Linux scsi driver the blksize == 0 if variable */
3835
 
        if (minfo.curblksz == 0) {
3836
 
            *varblk = BOOL_TRUE;
3837
 
        }
3838
 
        else {
3839
 
            *varblk = BOOL_FALSE;
3840
 
        }
 
3825
        if (TS_ISDRIVER) {
 
3826
                char value[MT_ATTR_MAX_VALLEN+1];
 
3827
                struct mt_attr mtattr;
 
3828
 
 
3829
                value[0] = '\0';
 
3830
                mtattr.ma_value = value;
 
3831
                mtattr.ma_name = MT_ATTR_NAME_VARIABLE;
 
3832
                mtattr.ma_vlen = sizeof(value);
 
3833
 
 
3834
                ioctl(contextp->dc_fd, MTGETATTR, &mtattr);
 
3835
 
 
3836
                if (strcmp(value, MT_ATTR_VALUE_TRUE) == 0)
 
3837
                        *varblk = BOOL_TRUE;
 
3838
                else if (strcmp(value, MT_ATTR_VALUE_FALSE) == 0)
 
3839
                        *varblk = BOOL_FALSE;
 
3840
                else
 
3841
                        return BOOL_FALSE; /* failure */
 
3842
        } else {
 
3843
                bool_t ok;
 
3844
                struct mtblkinfo minfo;
 
3845
 
 
3846
                ok = mt_blkinfo(contextp->dc_fd, &minfo);
 
3847
                if (!ok )
 
3848
                        return BOOL_FALSE; /* failure */
 
3849
 
 
3850
                /* for Linux scsi driver the blksize == 0 if variable */
 
3851
                if (minfo.curblksz == 0)
 
3852
                        *varblk = BOOL_TRUE;
 
3853
                else
 
3854
                        *varblk = BOOL_FALSE;
 
3855
        }
 
3856
 
3841
3857
        return BOOL_TRUE;
3842
3858
}
3843
3859