Page MenuHomeFreeBSD

D31686.id94197.diff
No OneTemporary

D31686.id94197.diff

Index: sys/cam/scsi/scsi_enc.h
===================================================================
--- sys/cam/scsi/scsi_enc.h
+++ sys/cam/scsi/scsi_enc.h
@@ -75,23 +75,23 @@
*
*
* An application finds out how many elements an enclosure instance
- * is managing by performing a ENCIOC_GETNELM operation. It then
- * performs a ENCIOC_GETELMMAP to get the map that contains the
- * elment identifiers for all elements (see encioc_element_t below).
+ * manages by performing a ENCIOC_GETNELM operation. It then
+ * performs an ENCIOC_GETELMMAP to get the map that contains the
+ * element identifiers for all elements (see encioc_element_t below).
* This information is static.
*
* The application may perform ENCIOC_GETELMSTAT operations to retrieve
- * status on an element (see the enc_elm_status_t structure below),
- * ENCIOC_SETELMSTAT operations to set status for an element.
+ * status on an element (see the encioc_elm_status_t structure below),
+ * and ENCIOC_SETELMSTAT operations to set status for an element.
*
- * Similarly, overall enclosure status me be fetched or set via
- * ENCIOC_GETENCSTAT or ENCIOC_SETENCSTAT operations (see encioc_enc_status_t
+ * Similarly, overall enclosure status may be fetched or set via
+ * ENCIOC_GETENCSTAT or ENCIOC_SETENCSTAT operations (see encioc_enc_status_t
* below).
*
* Readers should note that there is nothing that requires either a set
* or a clear operation to actually latch and do anything in the target.
*
- * A ENCIOC_INIT operation causes the enclosure to be initialized.
+ * An ENCIOC_INIT operation causes the enclosure to be initialized.
*/
/* Element Types */
Index: sys/cam/scsi/scsi_enc.c
===================================================================
--- sys/cam/scsi/scsi_enc.c
+++ sys/cam/scsi/scsi_enc.c
@@ -359,12 +359,6 @@
struct thread *td)
{
struct cam_periph *periph;
- encioc_enc_status_t tmp;
- encioc_string_t sstr;
- encioc_elm_status_t elms;
- encioc_elm_desc_t elmd;
- encioc_elm_devnames_t elmdn;
- encioc_element_t *uelm;
enc_softc_t *enc;
enc_cache_t *cache;
void *addr;
@@ -441,7 +435,9 @@
error = copyout(&cache->nelms, addr, sizeof (cache->nelms));
break;
- case ENCIOC_GETELMMAP:
+ case ENCIOC_GETELMMAP: {
+ encioc_element_t *uelm;
+
for (uelm = addr, i = 0; i != cache->nelms; i++) {
encioc_element_t kelm;
kelm.elm_idx = i;
@@ -452,21 +448,15 @@
break;
}
break;
-
- case ENCIOC_GETENCSTAT:
- cam_periph_lock(periph);
- error = enc->enc_vec.get_enc_status(enc, 1);
- if (error) {
- cam_periph_unlock(periph);
- break;
- }
- tmp = cache->enc_status;
- cam_periph_unlock(periph);
- error = copyout(&tmp, addr, sizeof(tmp));
- cache->enc_status = tmp;
+ }
+ case ENCIOC_GETENCSTAT: {
+ error = copyout(&cache->enc_status, addr,
+ sizeof(cache->enc_status));
break;
+ }
+ case ENCIOC_SETENCSTAT: {
+ encioc_enc_status_t tmp;
- case ENCIOC_SETENCSTAT:
error = copyin(addr, &tmp, sizeof(tmp));
if (error)
break;
@@ -474,11 +464,13 @@
error = enc->enc_vec.set_enc_status(enc, tmp, 1);
cam_periph_unlock(periph);
break;
-
+ }
case ENCIOC_GETSTRING:
case ENCIOC_SETSTRING:
case ENCIOC_GETENCNAME:
- case ENCIOC_GETENCID:
+ case ENCIOC_GETENCID: {
+ encioc_string_t sstr;
+
if (enc->enc_vec.handle_string == NULL) {
error = EINVAL;
break;
@@ -494,8 +486,10 @@
&((encioc_string_t *)addr)->bufsiz,
sizeof(sstr.bufsiz));
break;
+ }
+ case ENCIOC_GETELMSTAT: {
+ encioc_elm_status_t elms;
- case ENCIOC_GETELMSTAT:
error = copyin(addr, &elms, sizeof(elms));
if (error)
break;
@@ -510,8 +504,10 @@
break;
error = copyout(&elms, addr, sizeof(elms));
break;
+ }
+ case ENCIOC_GETELMDESC: {
+ encioc_elm_desc_t elmd;
- case ENCIOC_GETELMDESC:
error = copyin(addr, &elmd, sizeof(elmd));
if (error)
break;
@@ -527,8 +523,10 @@
elmd.elm_desc_len = 0;
error = copyout(&elmd, addr, sizeof(elmd));
break;
+ }
+ case ENCIOC_GETELMDEVNAMES: {
+ encioc_elm_devnames_t elmdn;
- case ENCIOC_GETELMDEVNAMES:
if (enc->enc_vec.get_elm_devnames == NULL) {
error = EINVAL;
break;
@@ -547,8 +545,10 @@
break;
error = copyout(&elmdn, addr, sizeof(elmdn));
break;
+ }
+ case ENCIOC_SETELMSTAT: {
+ encioc_elm_status_t elms;
- case ENCIOC_SETELMSTAT:
error = copyin(addr, &elms, sizeof(elms));
if (error)
break;
@@ -562,7 +562,7 @@
cam_periph_unlock(periph);
break;
-
+ }
case ENCIOC_INIT:
cam_periph_lock(periph);
Index: sys/cam/scsi/scsi_enc_internal.h
===================================================================
--- sys/cam/scsi/scsi_enc_internal.h
+++ sys/cam/scsi/scsi_enc_internal.h
@@ -88,13 +88,13 @@
typedef void (enc_softc_invalidate_t)(enc_softc_t *);
typedef void (enc_softc_cleanup_t)(enc_softc_t *);
typedef int (enc_init_enc_t)(enc_softc_t *);
-typedef int (enc_get_enc_status_t)(enc_softc_t *, int);
typedef int (enc_set_enc_status_t)(enc_softc_t *, encioc_enc_status_t, int);
typedef int (enc_get_elm_status_t)(enc_softc_t *, encioc_elm_status_t *, int);
typedef int (enc_set_elm_status_t)(enc_softc_t *, encioc_elm_status_t *, int);
typedef int (enc_get_elm_desc_t)(enc_softc_t *, encioc_elm_desc_t *);
typedef int (enc_get_elm_devnames_t)(enc_softc_t *, encioc_elm_devnames_t *);
-typedef int (enc_handle_string_t)(enc_softc_t *, encioc_string_t *, int);
+typedef int (enc_handle_string_t)(enc_softc_t *, encioc_string_t *,
+ unsigned long);
typedef void (enc_device_found_t)(enc_softc_t *);
typedef void (enc_poll_status_t)(enc_softc_t *);
@@ -102,7 +102,6 @@
enc_softc_invalidate_t *softc_invalidate;
enc_softc_cleanup_t *softc_cleanup;
enc_init_enc_t *init_enc;
- enc_get_enc_status_t *get_enc_status;
enc_set_enc_status_t *set_enc_status;
enc_get_elm_status_t *get_elm_status;
enc_set_elm_status_t *set_elm_status;
Index: sys/cam/scsi/scsi_enc_safte.c
===================================================================
--- sys/cam/scsi/scsi_enc_safte.c
+++ sys/cam/scsi/scsi_enc_safte.c
@@ -1023,13 +1023,6 @@
return (err);
}
-static int
-safte_get_enc_status(enc_softc_t *enc, int slpflg)
-{
-
- return (0);
-}
-
static int
safte_set_enc_status(enc_softc_t *enc, uint8_t encstat, int slpflag)
{
@@ -1101,7 +1094,6 @@
.softc_invalidate = safte_softc_invalidate,
.softc_cleanup = safte_softc_cleanup,
.init_enc = safte_init_enc,
- .get_enc_status = safte_get_enc_status,
.set_enc_status = safte_set_enc_status,
.get_elm_status = safte_get_elm_status,
.set_elm_status = safte_set_elm_status,
Index: sys/cam/scsi/scsi_enc_ses.c
===================================================================
--- sys/cam/scsi/scsi_enc_ses.c
+++ sys/cam/scsi/scsi_enc_ses.c
@@ -740,7 +740,7 @@
int
ses_elm_addlstatus_eip(struct ses_elm_addlstatus_base_hdr *hdr)
{
- return ((hdr)->byte0 >> 4) & 0x1;
+ return ((hdr)->byte0 >> 4 & 0x1);
}
int
ses_elm_addlstatus_invalid(struct ses_elm_addlstatus_base_hdr *hdr)
@@ -2745,13 +2745,6 @@
return (0);
}
-static int
-ses_get_enc_status(enc_softc_t *enc, int slpflag)
-{
- /* Automatically updated, caller checks enc_cache->encstat itself */
- return (0);
-}
-
static int
ses_set_enc_status(enc_softc_t *enc, uint8_t encstat, int slpflag)
{
@@ -2860,7 +2853,7 @@
* \return 0 on success, errno otherwise.
*/
static int
-ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc)
+ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, unsigned long ioc)
{
ses_softc_t *ses;
enc_cache_t *enc_cache;
@@ -2880,7 +2873,7 @@
ses_cache = enc_cache->private;
/* Implement SES2r20 6.1.6 */
- if (sstr->bufsiz > 0xffff)
+ if (sstr->bufsiz > ENC_STRING_MAX)
return (EINVAL); /* buffer size too large */
switch (ioc) {
@@ -2989,7 +2982,6 @@
.softc_invalidate = ses_softc_invalidate,
.softc_cleanup = ses_softc_cleanup,
.init_enc = ses_init_enc,
- .get_enc_status = ses_get_enc_status,
.set_enc_status = ses_set_enc_status,
.get_elm_status = ses_get_elm_status,
.set_elm_status = ses_set_elm_status,

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 17, 12:05 PM (17 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15838489
Default Alt Text
D31686.id94197.diff (7 KB)

Event Timeline