libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-devel] Re: Submission of new mmc function for libcdio


From: Rocky Bernstein
Subject: Re: [Libcdio-devel] Re: Submission of new mmc function for libcdio
Date: Thu, 28 Jan 2010 20:21:39 -0500

On further reflection, I think wise to change mmc_get_disc_erasable which
I'll do in the next couple of days. There should be an additional parameter
which is basically a driver_return_code_t that indicates whether the answer
is valid or not, and if not gives some idea of what went wrong. The caller
of this can also query SCSI sense data if this "valid" parameter says
something went wrong.

On Thu, Jan 28, 2010 at 7:40 PM, Rocky Bernstein
<address@hidden>wrote:

> Thanks for the code; this has now been committed in git.
>
> If there are further embellishments that can probably be easily
> accommodated.
>
> As is my current custom now, any new code generally gets some sort of test
> associated with it, even if here the test is just to see that if the driver
> has MMC available we can call the routine and not SEGV. The specific test
> has been added to test/driver/mmc which will show results when run in
> verbose mode.
>
>
>
> On Thu, Jan 28, 2010 at 11:49 AM, Frank Endres <address@hidden>wrote:
>
>> Maybe this version is more reliable (no more unportable guess on buffer
>> state in case of error). I think it is simplier to return false in case of
>> an error, it is also possible to return an error code (see comments).
>>
>> /*!
>>   Detects if a disc (CD or DVD) is erasable or not.
>>    @return true if the disc is detected as erasable (rewritable), false
>> otherwise.
>>  */
>> bool /* int */
>> mmc_get_disc_erasable ( const CdIo_t *p_cdio) {
>>  mmc_cdb_t cdb = {{0, }};
>>  uint8_t buf[42] = { 0, };
>>   int i_status;
>>
>>  CDIO_MMC_SET_COMMAND (cdb.field, CDIO_MMC_GPCMD_READ_DISC_INFO);
>>  CDIO_MMC_SET_READ_LENGTH8 (cdb.field, sizeof(buf));
>>
>>   i_status = mmc_run_cmd (p_cdio, 0, &cdb, SCSI_MMC_DATA_READ,
>> sizeof(buf),
>> &buf);
>>  if (i_status == 0) {
>>    if (buf[2] & 0x10)
>>       return true;
>>    else
>>      return false;
>>   } else
>>     return false; /* return DRIVER_OP_ERROR; */ /* return i_status; */
>> }
>>
>> Frank Endres
>>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]