Hi Jason,

Jason Zhao wrote:
> Thank you, Jan. Please see comments in line.
>
> jan damborsky wrote:
>>
>>> I am developing the test cases for libtd, and here I met with
>>> some questions about disk discovery cases.
>>> 1. about mtype attribute
>>> As I remember, in dwarf caiman project, libtd could find media
>>> type of each disks, but it only could discover "FIXED" one. Does
>>> it have any changes for OpenSolaris(i.e., could it find some devices
>>> which media type is not "FIXED"?).
>>>     
>>
>>
>> There are no changes in libtd with respect to this behavior in 
>> OpenSolaris.
>> libtd itself doesn't filter out disks with 'mtype' other than 'FIXED' -
>> those
>> are excluded later in orchestrator:
>>
>> http://src.opensolaris.org/source/xref/caiman/slim_source/usr/src/lib/liborchestrator/target_discovery.c#432
>>  
>>
>>
>>  
>>>  Besides "FIXED", are there any
>>> other types "media type"?
>>>     
>>
>> Yes, for full list of supported values which can be assigned to
>> 'mtype' see
>>
>> http://src.opensolaris.org/source/xref/caiman/slim_source/usr/src/lib/libtd/td_api.h#99
>>  
>>
>>   
> From the struct in td_api above.
>
> It looks like the devices not FIXED are "cdrom, floopy, ZIP, JAZ, DVD, 
> MO".
> But from last comments in this mail, DVD/CDROM and floopy are filtered
> out by libtd. Then, can I say all the media type libtd catches is
> FIXED one? I know ZIP, JAZ and MO are very rare in practice now.
> We do not have such devices yet.
>
> Or better yet, could you tell me how I can verify the "media-type",
> from "prtconf","inquiry-device-type" attribute or any other commands?

To be honest, I am not aware of reliable method,
how this information could be verified. rmformat(1)
might be used in some cases:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/rmformat/rmf_misc.c#1294

>>  
>>>  Following example is I tried on
>>> OpenSolaris x86 box.
>>> # test_td -d -v
>>> Disk discovery
>>> Total number of disks: 3
>>> -------------------------------------------------------------------------------
>>>  
>>>
>>> num | name| vendor| ctype| mtype| rem| lbl| bsize|#of blocks|size [MB]|
>>> -------------------------------------------------------------------------------
>>>  
>>>
>>> 1 | c1t0d0| Netac| usb| FIXED| Yes| F| 512| 3904768| 1906|
>>> 2 |* c4d0| unknown| ata| FIXED| No| VF| 512| 312576768| 152625|
>>> 3 | swap| unknown|unknown| UNKN| No| GF| 512| 1048576| 512|
>>> -------------------------------------------------------------------------------
>>>  
>>>
>>>
>>>
>>> 2. About removable attribute
>>> As it can be seen from above example that removable
>>> attribute is largely connected to the disk type(e.g.,
>>> usb or CDROM). How can I get if a device is removable?
>>> Through "rmformat"? It seems that there are mismatch
>>> between the output of "libtd" and the output of "rmformat"
>>> command.
>>>       
>>
>> libtd takes 'removable' attribute from libdiskmgt - looking at the
>> implementation, among other things libdiskmgt takes a look at
>> 'removable-media' property in device tree. If this property is set,
>> libdiskmgt reports media as removable - please see following source
>> code for implementation details and other cases when libdiskmgt
>> considers media to be removable (ZIP, JAZ, ...):
>>
>> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libdiskmgt/common/findevs.c
>>  
>>
>>
>> Based on this, you could check output of 'prtconf -v' for determining
>> if device is considered as removable by libdiskmgt (and libtd) - if
>> appropriate
>> disk has 'removable-media' property defined, libtd should report it as
>> removable.
>>   
> Thank you. Then I have a question here.
>
> I plug a usb-disk, and rmformat shows it is removable, and the
> dev line is "/dev/removable-media/dsk/c5t0d0s0", but prtconf -v
> doesn't have "removable-media" attribute. Could I see it is not
> a removable device?

yes - that usb disk will be reported by libtd as not removable.
I would expect that in such case /dev/removable-media/dsk/
directory wouldn't contain entry for that device.

Thank you,
Jan

>
> You can see the example in following.
>>  
>>> # test_td -d -v
>>> Disk discovery
>>> Total number of disks: 3
>>> -------------------------------------------------------------------------------
>>>  
>>>
>>> num | name| vendor| ctype| mtype| rem| lbl| bsize|#of blocks|size [MB]|
>>> -------------------------------------------------------------------------------
>>>  
>>>
>>> 1 | c1t0d0| IC25N040| usb| FIXED| No| F| 512| 78140160| 38154| <-- not
>>> removable
>>> 2 |* c4d0| unknown| ata| FIXED| No| VF| 512| 312576768| 152625|
>>> 3 | swap| unknown|unknown| UNKN| No| GF| 512| 1048576| 512|
>>> -------------------------------------------------------------------------------
>>>  
>>>
>>> # rmformat
>>> Looking for devices...
>>> 1. Logical Node: /dev/rdsk/c1t0d0p0
>>> Physical Node: /pci at 0,0/pci17aa,20ab at 1d,7/storage at 1/disk at 0,0
>>> Connected Device: IC25N040 ATMR04-0 0811
>>> Device Type: Removable <------ removable from rmformat.
>>> Bus: USB
>>> Size: 38.2 GB
>>> Label: <Unknown>
>>> Access permissions: Medium is not write protected.
>>> ......
>>>
>>>
>>>
>>>     If yes, what does it mean and how can I verify the
>>> attribute?
>>>
>>> 4. When I insert a CD into my DVD Drive, it seems
>>> like the test_td could not discover it as *CDROM*.
>>> Is it OK?
>>>     
>>
>> Yes, that is correct, CD/DVD and floppy drives are filtered out and
>> excluded from list of valid targets by libtd:
>>
>> http://src.opensolaris.org/source/xref/caiman/slim_source/usr/src/lib/libtd/td_dd.c#1100
>>  
>>
>>   
> Please see my first comment.
>
>
> Thanks
> Jason


Reply via email to