So I'm trying to work with SDcard media, which can be read-only, or 
read-write, and the SCSI layer.

What I'm doing in SCSA, is if the "lock" (write-protect switch) is set, 
indicating in the mode-sense data that the device is read-only.  
(DEVSPEC = 0x80).

This does seem to mostly work, *except* that the end result is that I 
cannot mount PCFS filesystems with this flag set.  I get back:

[EMAIL PROTECTED]> pfexec truss -f -t mount mount -F pcfs -o ro 
/dev/dsk/c2t0d0p0:1 /mnt
3708:   mount("/dev/dsk/c2t0d0p0:1", "/mnt", MS_OPTIONSTR, "pcfs", 
0x00000000, 0, 0x08063240, 1024) Err#30 EROFS
mount: Read-only file system

I've not drilled down to figure out where the EROFS is coming from, but 
it does strike me that if I'm asking pcfs to mount the filesystem 
read-only (with -o ro) it shouldn't try to open the device for writing.  
(The sd(7d) driver refuses open's of read-only devices when the writable 
bit is passed into open.  I've not looked at the implementation of 
mount, but I *believe* it boils down to an intra-kernel call of 
sdopen(), thereby running up against the checks against the check in 
sdopen() for oflag containing FWRITE.

So, what am I missing?  Shouldn't -o ro mounts of PCFS formatted media 
be acceptable?  (Interestingly enough, it appears that fd has a similar 
check for floppy disks:

        /*
         * if opening for writing, check write protect on diskette
         */
        if ((flag & FWRITE) && (fdp->d_obj->fj_flags & FUNIT_WPROT)) {
                sema_v(&fdp->d_ocsem);
                return (EROFS);
        }

But I'm unable to test this at the moment, lacking systems with floppy 
drives!  (I may try to track one down...)

    -- Garrett

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to