Commit 0bde4b78 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390: dasd driver coding style (2/2)

s390 dasd driver:
 - Coding style adaptions. Removed almost all typedefs from the dasd driver.
parent d96d6867
This diff is collapsed.
......@@ -5,10 +5,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.6 $
*
* History of changes
*
* $Revision: 1.8 $
*/
#ifndef DASD_ECKD_H
......@@ -52,49 +49,49 @@
* SECTION: Type Definitions
******************************************************************************/
typedef struct eckd_count_t {
struct eckd_count {
__u16 cyl;
__u16 head;
__u8 record;
__u8 kl;
__u16 dl;
} __attribute__ ((packed)) eckd_count_t;
} __attribute__ ((packed));
typedef struct ch_t {
struct ch_t {
__u16 cyl;
__u16 head;
} __attribute__ ((packed)) ch_t;
} __attribute__ ((packed));
typedef struct chs_t {
struct chs_t {
__u16 cyl;
__u16 head;
__u32 sector;
} __attribute__ ((packed)) chs_t;
} __attribute__ ((packed));
typedef struct chr_t {
struct chr_t {
__u16 cyl;
__u16 head;
__u8 record;
} __attribute__ ((packed)) chr_t;
} __attribute__ ((packed));
typedef struct geom_t {
struct geom_t {
__u16 cyl;
__u16 head;
__u32 sector;
} __attribute__ ((packed)) geom_t;
} __attribute__ ((packed));
typedef struct eckd_home_t {
struct eckd_home {
__u8 skip_control[14];
__u16 cell_number;
__u8 physical_addr[3];
__u8 flag;
ch_t track_addr;
struct ch_t track_addr;
__u8 reserved;
__u8 key_length;
__u8 reserved2[2];
} __attribute__ ((packed)) eckd_home_t;
} __attribute__ ((packed));
typedef struct DE_eckd_data_t {
struct DE_eckd_data {
struct {
unsigned char perm:2; /* Permissions on this extent */
unsigned char reserved:1;
......@@ -113,15 +110,15 @@ typedef struct DE_eckd_data_t {
__u16 fast_write_id;
__u8 ga_additional; /* Global Attributes Additional */
__u8 ga_extended; /* Global Attributes Extended */
ch_t beg_ext;
ch_t end_ext;
struct ch_t beg_ext;
struct ch_t end_ext;
unsigned long long ep_sys_time; /* Extended Parameter - System Time Stamp */
__u8 ep_format; /* Extended Parameter format byte */
__u8 ep_prio; /* Extended Parameter priority I/O byte */
__u8 ep_reserved[6]; /* Extended Parameter Reserved */
} __attribute__ ((packed)) DE_eckd_data_t;
} __attribute__ ((packed));
typedef struct LO_eckd_data_t {
struct LO_eckd_data {
struct {
unsigned char orientation:2;
unsigned char operation:6;
......@@ -133,13 +130,13 @@ typedef struct LO_eckd_data_t {
} __attribute__ ((packed)) auxiliary;
__u8 unused;
__u8 count;
ch_t seek_addr;
chr_t search_arg;
struct ch_t seek_addr;
struct chr_t search_arg;
__u8 sector;
__u16 length;
} __attribute__ ((packed)) LO_eckd_data_t;
} __attribute__ ((packed));
typedef struct dasd_eckd_characteristics_t {
struct dasd_eckd_characteristics {
__u16 cu_type;
struct {
unsigned char support:2;
......@@ -210,9 +207,9 @@ typedef struct dasd_eckd_characteristics_t {
__u8 factor8;
__u8 reserved2[3];
__u8 reserved3[10];
} __attribute__ ((packed)) dasd_eckd_characteristics_t;
} __attribute__ ((packed));
typedef struct dasd_eckd_confdata_t {
struct dasd_eckd_confdata {
struct {
struct {
unsigned char identifier:2;
......@@ -327,17 +324,17 @@ typedef struct dasd_eckd_confdata_t {
__u8 log_dev_address;
unsigned char reserved2[12];
} __attribute__ ((packed)) neq;
} __attribute__ ((packed)) dasd_eckd_confdata_t;
} __attribute__ ((packed));
/*
* Perform Subsystem Function - Prepare for Read Subsystem Data
*/
typedef struct dasd_psf_prssd_data_t {
struct dasd_psf_prssd_data {
unsigned char order;
unsigned char flags;
unsigned char reserved[4];
unsigned char suborder;
unsigned char varies[9];
} __attribute__ ((packed)) dasd_psf_prssd_data_t;
} __attribute__ ((packed));
#endif /* DASD_ECKD_H */
......@@ -7,14 +7,10 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
*
* $Revision: 1.6 $
*
* History of changes
* 05/04/02 split from dasd.c, code restructuring.
* $Revision: 1.9 $
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/ctype.h>
#include <linux/init.h>
......@@ -27,12 +23,12 @@
#include "dasd_int.h"
dasd_ccw_req_t *
struct dasd_ccw_req *
dasd_alloc_erp_request(char *magic, int cplength, int datasize,
dasd_device_t * device)
struct dasd_device * device)
{
unsigned long flags;
dasd_ccw_req_t *cqr;
struct dasd_ccw_req *cqr;
char *data;
int size;
......@@ -45,18 +41,19 @@ dasd_alloc_erp_request(char *magic, int cplength, int datasize,
debug_int_event ( dasd_debug_area, 1, cplength);
debug_int_event ( dasd_debug_area, 1, datasize);
size = (sizeof(dasd_ccw_req_t) + 7L) & -8L;
size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
if (cplength > 0)
size += cplength * sizeof(struct ccw1);
if (datasize > 0)
size += datasize;
spin_lock_irqsave(&device->mem_lock, flags);
cqr = (dasd_ccw_req_t *) dasd_alloc_chunk(&device->erp_chunks, size);
cqr = (struct dasd_ccw_req *)
dasd_alloc_chunk(&device->erp_chunks, size);
spin_unlock_irqrestore(&device->mem_lock, flags);
if (cqr == NULL)
return ERR_PTR(-ENOMEM);
memset(cqr, 0, sizeof(dasd_ccw_req_t));
data = (char *) cqr + ((sizeof(dasd_ccw_req_t) + 7L) & -8L);
memset(cqr, 0, sizeof(struct dasd_ccw_req));
data = (char *) cqr + ((sizeof(struct dasd_ccw_req) + 7L) & -8L);
cqr->cpaddr = NULL;
if (cplength > 0) {
cqr->cpaddr = (struct ccw1 *) data;
......@@ -75,7 +72,7 @@ dasd_alloc_erp_request(char *magic, int cplength, int datasize,
}
void
dasd_free_erp_request(dasd_ccw_req_t * cqr, dasd_device_t * device)
dasd_free_erp_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
{
unsigned long flags;
......@@ -91,8 +88,8 @@ dasd_free_erp_request(dasd_ccw_req_t * cqr, dasd_device_t * device)
/*
* DESCRIPTION
* sets up the default-ERP dasd_ccw_req_t, namely one, which performs a TIC
* to the original channel program with a retry counter of 16
* sets up the default-ERP struct dasd_ccw_req, namely one, which performs
* a TIC to the original channel program with a retry counter of 16
*
* PARAMETER
* cqr failed CQR
......@@ -100,11 +97,11 @@ dasd_free_erp_request(dasd_ccw_req_t * cqr, dasd_device_t * device)
* RETURN VALUES
* erp CQR performing the ERP
*/
dasd_ccw_req_t *
dasd_default_erp_action(dasd_ccw_req_t * cqr)
struct dasd_ccw_req *
dasd_default_erp_action(struct dasd_ccw_req * cqr)
{
dasd_device_t *device;
dasd_ccw_req_t *erp;
struct dasd_device *device;
struct dasd_ccw_req *erp;
MESSAGE(KERN_DEBUG, "%s", "Default ERP called... ");
device = cqr->device;
......@@ -147,10 +144,10 @@ dasd_default_erp_action(dasd_ccw_req_t * cqr)
* RETURN VALUES
* cqr pointer to the original CQR
*/
dasd_ccw_req_t *
dasd_default_erp_postaction(dasd_ccw_req_t * cqr)
struct dasd_ccw_req *
dasd_default_erp_postaction(struct dasd_ccw_req * cqr)
{
dasd_device_t *device;
struct dasd_device *device;
int success;
if (cqr->refers == NULL || cqr->function == NULL)
......@@ -161,7 +158,7 @@ dasd_default_erp_postaction(dasd_ccw_req_t * cqr)
/* free all ERPs - but NOT the original cqr */
while (cqr->refers != NULL) {
dasd_ccw_req_t *refers;
struct dasd_ccw_req *refers;
refers = cqr->refers;
/* remove the request from the device queue */
......@@ -189,7 +186,7 @@ dasd_default_erp_postaction(dasd_ccw_req_t * cqr)
* real request.
*/
static inline void
hex_dump_memory(dasd_device_t *device, void *data, int len)
hex_dump_memory(struct dasd_device *device, void *data, int len)
{
int *pint;
......@@ -203,9 +200,9 @@ hex_dump_memory(dasd_device_t *device, void *data, int len)
}
void
dasd_log_sense(dasd_ccw_req_t *cqr, struct irb *irb)
dasd_log_sense(struct dasd_ccw_req *cqr, struct irb *irb)
{
dasd_device_t *device;
struct dasd_device *device;
device = cqr->device;
/* dump sense data */
......@@ -214,10 +211,10 @@ dasd_log_sense(dasd_ccw_req_t *cqr, struct irb *irb)
}
void
dasd_log_ccw(dasd_ccw_req_t * cqr, int caller, __u32 cpa)
dasd_log_ccw(struct dasd_ccw_req * cqr, int caller, __u32 cpa)
{
dasd_device_t *device;
dasd_ccw_req_t *lcqr;
struct dasd_device *device;
struct dasd_ccw_req *lcqr;
struct ccw1 *ccw;
int cplength;
......@@ -227,7 +224,7 @@ dasd_log_ccw(dasd_ccw_req_t * cqr, int caller, __u32 cpa)
DEV_MESSAGE(KERN_ERR, device,
"(%s) ERP chain report for req: %p",
caller == 0 ? "EXAMINE" : "ACTION", lcqr);
hex_dump_memory(device, lcqr, sizeof(dasd_ccw_req_t));
hex_dump_memory(device, lcqr, sizeof(struct dasd_ccw_req));
cplength = 1;
ccw = lcqr->cpaddr;
......
......@@ -4,12 +4,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.27 $
*
* History of changes
* fixed partition handling and HDIO_GETGEO
* 2002/01/04 Created 2.4-2.5 compatibility mode
* 05/04/02 code restructuring.
* $Revision: 1.29 $
*/
#include <linux/config.h>
......@@ -44,11 +39,11 @@
MODULE_LICENSE("GPL");
static dasd_discipline_t dasd_fba_discipline;
static struct dasd_discipline dasd_fba_discipline;
typedef struct dasd_fba_private_t {
dasd_fba_characteristics_t rdc_data;
} dasd_fba_private_t;
struct dasd_fba_private {
struct dasd_fba_characteristics rdc_data;
};
static struct ccw_device_id dasd_fba_ids[] = {
{ CCW_DEVICE_DEVTYPE (0x6310, 0, 0x9336, 0), driver_info: 0x1},
......@@ -82,14 +77,14 @@ static struct ccw_driver dasd_fba_driver = {
};
static inline void
define_extent(struct ccw1 * ccw, DE_fba_data_t *data, int rw,
define_extent(struct ccw1 * ccw, struct DE_fba_data *data, int rw,
int blksize, int beg, int nr)
{
ccw->cmd_code = DASD_FBA_CCW_DEFINE_EXTENT;
ccw->flags = 0;
ccw->count = 16;
ccw->cda = (__u32) __pa(data);
memset(data, 0, sizeof (DE_fba_data_t));
memset(data, 0, sizeof (struct DE_fba_data));
if (rw == WRITE)
(data->mask).perm = 0x0;
else if (rw == READ)
......@@ -102,14 +97,14 @@ define_extent(struct ccw1 * ccw, DE_fba_data_t *data, int rw,
}
static inline void
locate_record(struct ccw1 * ccw, LO_fba_data_t *data, int rw,
locate_record(struct ccw1 * ccw, struct LO_fba_data *data, int rw,
int block_nr, int block_ct)
{
ccw->cmd_code = DASD_FBA_CCW_LOCATE;
ccw->flags = 0;
ccw->count = 8;
ccw->cda = (__u32) __pa(data);
memset(data, 0, sizeof (LO_fba_data_t));
memset(data, 0, sizeof (struct LO_fba_data));
if (rw == WRITE)
data->operation.cmd = 0x5;
else if (rw == READ)
......@@ -121,16 +116,16 @@ locate_record(struct ccw1 * ccw, LO_fba_data_t *data, int rw,
}
static int
dasd_fba_check_characteristics(struct dasd_device_t *device)
dasd_fba_check_characteristics(struct dasd_device *device)
{
dasd_fba_private_t *private;
struct dasd_fba_private *private;
struct ccw_device *cdev = device->cdev;
void *rdc_data;
int rc;
private = (dasd_fba_private_t *) device->private;
private = (struct dasd_fba_private *) device->private;
if (private == NULL) {
private = kmalloc(sizeof(dasd_fba_private_t), GFP_KERNEL);
private = kmalloc(sizeof(struct dasd_fba_private), GFP_KERNEL);
if (private == NULL) {
MESSAGE(KERN_WARNING, "%s",
"memory allocation failed for private data");
......@@ -160,12 +155,12 @@ dasd_fba_check_characteristics(struct dasd_device_t *device)
}
static int
dasd_fba_do_analysis(struct dasd_device_t *device)
dasd_fba_do_analysis(struct dasd_device *device)
{
dasd_fba_private_t *private;
struct dasd_fba_private *private;
int sb, rc;
private = (dasd_fba_private_t *) device->private;
private = (struct dasd_fba_private *) device->private;
rc = dasd_check_blocksize(private->rdc_data.blk_size);
if (rc) {
DEV_MESSAGE(KERN_INFO, device, "unknown blocksize %d",
......@@ -181,7 +176,7 @@ dasd_fba_do_analysis(struct dasd_device_t *device)
}
static int
dasd_fba_fill_geometry(struct dasd_device_t *device, struct hd_geometry *geo)
dasd_fba_fill_geometry(struct dasd_device *device, struct hd_geometry *geo)
{
if (dasd_check_blocksize(device->bp_block) != 0)
return -EINVAL;
......@@ -192,12 +187,12 @@ dasd_fba_fill_geometry(struct dasd_device_t *device, struct hd_geometry *geo)
}
static dasd_era_t
dasd_fba_examine_error(dasd_ccw_req_t * cqr, struct irb * irb)
dasd_fba_examine_error(struct dasd_ccw_req * cqr, struct irb * irb)
{
dasd_device_t *device;
struct dasd_device *device;
struct ccw_device *cdev;
device = (dasd_device_t *) cqr->device;
device = (struct dasd_device *) cqr->device;
if (irb->scsw.cstat == 0x00 &&
irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
return dasd_era_none;
......@@ -214,13 +209,13 @@ dasd_fba_examine_error(dasd_ccw_req_t * cqr, struct irb * irb)
}
static dasd_erp_fn_t
dasd_fba_erp_action(dasd_ccw_req_t * cqr)
dasd_fba_erp_action(struct dasd_ccw_req * cqr)
{
return dasd_default_erp_action;
}
static dasd_erp_fn_t
dasd_fba_erp_postaction(dasd_ccw_req_t * cqr)
dasd_fba_erp_postaction(struct dasd_ccw_req * cqr)
{
if (cqr->function == dasd_default_erp_action)
return dasd_default_erp_postaction;
......@@ -230,13 +225,13 @@ dasd_fba_erp_postaction(dasd_ccw_req_t * cqr)
return NULL;
}
static dasd_ccw_req_t *
dasd_fba_build_cp(dasd_device_t * device, struct request *req)
static struct dasd_ccw_req *
dasd_fba_build_cp(struct dasd_device * device, struct request *req)
{
dasd_fba_private_t *private;
struct dasd_fba_private *private;
unsigned long *idaws;
LO_fba_data_t *LO_data;
dasd_ccw_req_t *cqr;
struct LO_fba_data *LO_data;
struct dasd_ccw_req *cqr;
struct ccw1 *ccw;
struct bio *bio;
struct bio_vec *bv;
......@@ -247,7 +242,7 @@ dasd_fba_build_cp(dasd_device_t * device, struct request *req)
unsigned char cmd;
int i;
private = (dasd_fba_private_t *) device->private;
private = (struct dasd_fba_private *) device->private;
if (rq_data_dir(req) == READ) {
cmd = DASD_FBA_CCW_READ;
} else if (rq_data_dir(req) == WRITE) {
......@@ -279,7 +274,7 @@ dasd_fba_build_cp(dasd_device_t * device, struct request *req)
/* 1x define extent + 1x locate record + number of blocks */
cplength = 2 + count;
/* 1x define extent + 1x locate record */
datasize = sizeof(DE_fba_data_t) + sizeof(LO_fba_data_t) +
datasize = sizeof(struct DE_fba_data) + sizeof(struct LO_fba_data) +
cidaw * sizeof(unsigned long);
/*
* Find out number of additional locate record ccws if the device
......@@ -287,7 +282,7 @@ dasd_fba_build_cp(dasd_device_t * device, struct request *req)
*/
if (private->rdc_data.mode.bits.data_chain == 0) {
cplength += count - 1;
datasize += (count - 1)*sizeof(LO_fba_data_t);
datasize += (count - 1)*sizeof(struct LO_fba_data);
}
/* Allocate the ccw request. */
cqr = dasd_smalloc_request(dasd_fba_discipline.name,
......@@ -299,8 +294,8 @@ dasd_fba_build_cp(dasd_device_t * device, struct request *req)
define_extent(ccw++, cqr->data, rq_data_dir(req),
device->bp_block, req->sector, req->nr_sectors);
/* Build locate_record + read/write ccws. */
idaws = (unsigned long *) (cqr->data + sizeof(DE_fba_data_t));
LO_data = (LO_fba_data_t *) (idaws + cidaw);
idaws = (unsigned long *) (cqr->data + sizeof(struct DE_fba_data));
LO_data = (struct LO_fba_data *) (idaws + cidaw);
/* Locate record for all blocks for smart devices. */
if (private->rdc_data.mode.bits.data_chain != 0) {
ccw[-1].flags |= CCW_FLAG_CC;
......@@ -346,21 +341,22 @@ dasd_fba_build_cp(dasd_device_t * device, struct request *req)
}
static int
dasd_fba_fill_info(dasd_device_t * device, dasd_information2_t * info)
dasd_fba_fill_info(struct dasd_device * device,
struct dasd_information2_t * info)
{
info->label_block = 1;
info->FBA_layout = 1;
info->format = DASD_FORMAT_LDL;
info->characteristics_size = sizeof(dasd_fba_characteristics_t);
info->characteristics_size = sizeof(struct dasd_fba_characteristics);
memcpy(info->characteristics,
&((dasd_fba_private_t *) device->private)->rdc_data,
sizeof (dasd_fba_characteristics_t));
&((struct dasd_fba_private *) device->private)->rdc_data,
sizeof (struct dasd_fba_characteristics));
info->confdata_size = 0;
return 0;
}
static void
dasd_fba_dump_sense(struct dasd_device_t *device, dasd_ccw_req_t * req,
dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
struct irb *irb)
{
char *page;
......@@ -383,7 +379,7 @@ dasd_fba_dump_sense(struct dasd_device_t *device, dasd_ccw_req_t * req,
* max_blocks is dependent on the amount of storage that is available
* in the static io buffer for each device. Currently each device has
* 8192 bytes (=2 pages). For 64 bit one dasd_mchunkt_t structure has
* 24 bytes, the dasd_ccw_req_t has 136 bytes and each block can use
* 24 bytes, the struct dasd_ccw_req has 136 bytes and each block can use
* up to 16 bytes (8 for the ccw and 8 for the idal pointer). In
* addition we have one define extent ccw + 16 bytes of data and a
* locate record ccw for each block (stupid devices!) + 16 bytes of data.
......@@ -393,7 +389,7 @@ dasd_fba_dump_sense(struct dasd_device_t *device, dasd_ccw_req_t * req,
* start the next request if one finishes off. That makes 100.1 blocks
* for one request. Give a little safety and the result is 96.
*/
static dasd_discipline_t dasd_fba_discipline = {
static struct dasd_discipline dasd_fba_discipline = {
.owner = THIS_MODULE,
.name = "FBA ",
.ebcname = "FBA ",
......
......@@ -4,17 +4,13 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.4 $
*
* History of changes
*
* $Revision: 1.6 $
*/
#ifndef DASD_FBA_H
#define DASD_FBA_H
typedef
struct DE_fba_data_t {
struct DE_fba_data {
struct {
unsigned char perm:2; /* Permissions on this extent */
unsigned char zero:2; /* Must be zero */
......@@ -27,12 +23,9 @@ typedef
__u32 ext_loc; /* Extent locator */
__u32 ext_beg; /* logical number of block 0 in extent */
__u32 ext_end; /* logocal number of last block in extent */
} __attribute__ ((packed))
DE_fba_data_t;
} __attribute__ ((packed));
typedef
struct LO_fba_data_t {
struct LO_fba_data {
struct {
unsigned char zero:4;
unsigned char cmd:4;
......@@ -40,12 +33,9 @@ typedef
__u8 auxiliary;
__u16 blk_ct;
__u32 blk_nr;
} __attribute__ ((packed))
} __attribute__ ((packed));
LO_fba_data_t;
typedef
struct dasd_fba_characteristics_t {
struct dasd_fba_characteristics {
union {
__u8 c;
struct {
......@@ -78,8 +68,6 @@ typedef
__u16 blk_ce;
__u32 reserved2;
__u16 reserved3;
} __attribute__ ((packed))
dasd_fba_characteristics_t;
} __attribute__ ((packed));
#endif /* DASD_FBA_H */
......@@ -9,10 +9,7 @@
*
* Dealing with devices registered to multiple major numbers.
*
* $Revision: 1.24 $
*
* History of changes
* 05/04/02 split from dasd.c, code restructuring.
* $Revision: 1.29 $
*/
#include <linux/config.h>
......@@ -161,30 +158,6 @@ dasd_gendisk_alloc(int devindex)
return gdp;
}
/*
* Return devindex of first device using a specific major number.
*/
static int dasd_gendisk_major_index(int major)
{
struct list_head *l;
struct major_info *mi;
int devindex, rc;
spin_lock(&dasd_major_lock);
rc = -EINVAL;
devindex = 0;
list_for_each(l, &dasd_major_info) {
mi = list_entry(l, struct major_info, list);
if (mi->major == major) {
rc = devindex;
break;
}
devindex += DASD_PER_MAJOR;
}
spin_unlock(&dasd_major_lock);
return rc;
}
/*
* Return major number for device with device index devindex.
*/
......@@ -210,7 +183,7 @@ int dasd_gendisk_index_major(int devindex)
* Register disk to genhd. This will trigger a partition detection.
*/
void
dasd_setup_partitions(dasd_device_t * device)
dasd_setup_partitions(struct dasd_device * device)
{
/* Make the disk known. */
set_capacity(device->gdp, device->blocks << device->s2b_shift);
......@@ -225,7 +198,7 @@ dasd_setup_partitions(dasd_device_t * device)
* partitions unusable by setting their size to zero.
*/
void
dasd_destroy_partitions(dasd_device_t * device)
dasd_destroy_partitions(struct dasd_device * device)
{
del_gendisk(device->gdp);
put_disk(device->gdp);
......
This diff is collapsed.
......@@ -8,8 +8,6 @@
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
*
* i/o controls for the dasd driver.
*
* 05/04/02 split from dasd.c, code restructuring.
*/
#include <linux/config.h>
#include <linux/interrupt.h>
......@@ -34,15 +32,14 @@ static struct list_head dasd_ioctl_list = LIST_HEAD_INIT(dasd_ioctl_list);
/*
* Find the ioctl with number no.
*/
static dasd_ioctl_list_t *
static struct dasd_ioctl *
dasd_find_ioctl(int no)
{
struct list_head *curr;
list_for_each (curr, &dasd_ioctl_list) {
if (list_entry (curr, dasd_ioctl_list_t, list)->no == no) {
return list_entry (curr, dasd_ioctl_list_t, list);
}
}
struct dasd_ioctl *ioctl;
list_for_each_entry (ioctl, &dasd_ioctl_list, list)
if (ioctl->no == no)
return ioctl;
return NULL;
}
......@@ -52,10 +49,10 @@ dasd_find_ioctl(int no)
int
dasd_ioctl_no_register(struct module *owner, int no, dasd_ioctl_fn_t handler)
{
dasd_ioctl_list_t *new;
struct dasd_ioctl *new;
if (dasd_find_ioctl(no))
return -EBUSY;
new = kmalloc(sizeof (dasd_ioctl_list_t), GFP_KERNEL);
new = kmalloc(sizeof (struct dasd_ioctl), GFP_KERNEL);
if (new == NULL)
return -ENOMEM;
new->owner = owner;
......@@ -72,7 +69,7 @@ dasd_ioctl_no_register(struct module *owner, int no, dasd_ioctl_fn_t handler)
int
dasd_ioctl_no_unregister(struct module *owner, int no, dasd_ioctl_fn_t handler)
{
dasd_ioctl_list_t *old = dasd_find_ioctl(no);
struct dasd_ioctl *old = dasd_find_ioctl(no);
if (old == NULL)
return -ENOENT;
if (old->no != no || old->handler != handler || owner != old->owner)
......@@ -88,9 +85,8 @@ dasd_ioctl(struct inode *inp, struct file *filp,
unsigned int no, unsigned long data)
{
struct block_device *bdev = inp->i_bdev;
dasd_device_t *device = bdev->bd_disk->private_data;
dasd_ioctl_list_t *ioctl;
struct list_head *l;
struct dasd_device *device = bdev->bd_disk->private_data;
struct dasd_ioctl *ioctl;
const char *dir;
int rc;
......@@ -106,8 +102,7 @@ dasd_ioctl(struct inode *inp, struct file *filp,
"ioctl 0x%08x %s'0x%x'%d(%d) with data %8lx", no,
dir, _IOC_TYPE(no), _IOC_NR(no), _IOC_SIZE(no), data);
/* Search for ioctl no in the ioctl list. */
list_for_each(l, &dasd_ioctl_list) {
ioctl = list_entry(l, dasd_ioctl_list_t, list);
list_for_each_entry(ioctl, &dasd_ioctl_list, list) {
if (ioctl->no == no) {
/* Found a matching ioctl. Call it. */
if (!try_module_get(ioctl->owner))
......@@ -139,7 +134,7 @@ dasd_ioctl_api_version(struct block_device *bdev, int no, long args)
static int
dasd_ioctl_enable(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
struct dasd_device *device;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
......@@ -156,7 +151,7 @@ dasd_ioctl_enable(struct block_device *bdev, int no, long args)
static int
dasd_ioctl_disable(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
struct dasd_device *device;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
......@@ -182,9 +177,9 @@ dasd_ioctl_disable(struct block_device *bdev, int no, long args)
* devices this means CCWs are generated to format a single track.
*/
static int
dasd_format(dasd_device_t * device, format_data_t * fdata)
dasd_format(struct dasd_device * device, struct format_data_t * fdata)
{
dasd_ccw_req_t *cqr;
struct dasd_ccw_req *cqr;
int rc;
if (device->discipline->format_device == NULL)
......@@ -226,8 +221,8 @@ dasd_format(dasd_device_t * device, format_data_t * fdata)
static int
dasd_ioctl_format(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
format_data_t fdata;
struct dasd_device *device;
struct format_data_t fdata;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
......@@ -240,7 +235,8 @@ dasd_ioctl_format(struct block_device *bdev, int no, long args)
return -ENODEV;
if (device->ro_flag)
return -EROFS;
if (copy_from_user(&fdata, (void *) args, sizeof (format_data_t)))
if (copy_from_user(&fdata, (void *) args,
sizeof (struct format_data_t)))
return -EFAULT;
if (bdev != bdev->bd_contains) {
DEV_MESSAGE(KERN_WARNING, device, "%s",
......@@ -257,7 +253,7 @@ dasd_ioctl_format(struct block_device *bdev, int no, long args)
static int
dasd_ioctl_reset_profile(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
struct dasd_device *device;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
......@@ -266,7 +262,7 @@ dasd_ioctl_reset_profile(struct block_device *bdev, int no, long args)
if (device == NULL)
return -ENODEV;
memset(&device->profile, 0, sizeof (dasd_profile_info_t));
memset(&device->profile, 0, sizeof (struct dasd_profile_info_t));
return 0;
}
......@@ -276,14 +272,14 @@ dasd_ioctl_reset_profile(struct block_device *bdev, int no, long args)
static int
dasd_ioctl_read_profile(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
struct dasd_device *device;
device = bdev->bd_disk->private_data;
if (device == NULL)
return -ENODEV;
if (copy_to_user((long *) args, (long *) &device->profile,
sizeof (dasd_profile_info_t)))
sizeof (struct dasd_profile_info_t)))
return -EFAULT;
return 0;
}
......@@ -307,8 +303,8 @@ dasd_ioctl_read_profile(struct block_device *bdev, int no, long args)
static int
dasd_ioctl_information(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
dasd_information2_t *dasd_info;
struct dasd_device *device;
struct dasd_information2_t *dasd_info;
unsigned long flags;
int rc;
struct ccw_device *cdev;
......@@ -320,7 +316,7 @@ dasd_ioctl_information(struct block_device *bdev, int no, long args)
if (!device->discipline->fill_info)
return -EINVAL;
dasd_info = kmalloc(sizeof(dasd_information2_t), GFP_KERNEL);
dasd_info = kmalloc(sizeof(struct dasd_information2_t), GFP_KERNEL);
if (dasd_info == NULL)
return -ENOMEM;
......@@ -379,8 +375,8 @@ dasd_ioctl_information(struct block_device *bdev, int no, long args)
rc = 0;
if (copy_to_user((long *) args, (long *) dasd_info,
((no == (unsigned int) BIODASDINFO2) ?
sizeof (dasd_information2_t) :
sizeof (dasd_information_t))))
sizeof (struct dasd_information2_t) :
sizeof (struct dasd_information_t))))
rc = -EFAULT;
kfree(dasd_info);
return rc;
......@@ -392,7 +388,7 @@ dasd_ioctl_information(struct block_device *bdev, int no, long args)
static int
dasd_ioctl_set_ro(struct block_device *bdev, int no, long args)
{
dasd_device_t *device;
struct dasd_device *device;
int intval;
if (!capable(CAP_SYS_ADMIN))
......@@ -417,7 +413,7 @@ static int
dasd_ioctl_getgeo(struct block_device *bdev, int no, long args)
{
struct hd_geometry geo = { 0, };
dasd_device_t *device;
struct dasd_device *device;
device = bdev->bd_disk->private_data;
if (device == NULL)
......
......@@ -9,14 +9,10 @@
*
* /proc interface for the dasd driver.
*
* $Revision: 1.18 $
*
* History of changes
* 05/04/02 split from dasd.c, code restructuring.
* $Revision: 1.21 $
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/ctype.h>
#include <linux/seq_file.h>
#include <linux/vmalloc.h>
......@@ -56,7 +52,7 @@ dasd_get_user_string(const char *user_buf, size_t user_len)
static int
dasd_devices_show(struct seq_file *m, void *v)
{
dasd_device_t *device;
struct dasd_device *device;
char *substr;
device = dasd_device_from_devindex((unsigned long) v - 1);
......@@ -186,7 +182,7 @@ dasd_statistics_read(char *page, char **start, off_t off,
{
unsigned long len;
#ifdef CONFIG_DASD_PROFILE
dasd_profile_info_t *prof;
struct dasd_profile_info_t *prof;
char *str;
int shift;
......@@ -263,14 +259,15 @@ dasd_statistics_write(struct file *file, const char *user_buf,
} else if (strcmp(str, "off") == 0) {
/* switch off and reset statistics profiling */
memset(&dasd_global_profile,
0, sizeof (dasd_profile_info_t));
0, sizeof (struct dasd_profile_info_t));
dasd_profile_level = DASD_PROFILE_OFF;
MESSAGE(KERN_INFO, "%s", "Statictics switched off");
} else
goto out_error;
} else if (strncmp(str, "reset", 5) == 0) {
/* reset the statistics */
memset(&dasd_global_profile, 0, sizeof (dasd_profile_info_t));
memset(&dasd_global_profile, 0,
sizeof (struct dasd_profile_info_t));
MESSAGE(KERN_INFO, "%s", "Statictics reset");
} else
goto out_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment