Commit bb8d2379 authored by Patrick Mochel's avatar Patrick Mochel

Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin

into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
parents 29b49883 71b9ad66
......@@ -43,14 +43,15 @@ drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
}
static ssize_t
drv_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf)
drv_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{
struct driver_attribute * drv_attr = to_drv_attr(attr);
struct device_driver * drv = to_driver(kobj);
ssize_t ret = 0;
if (drv_attr->store)
ret = drv_attr->store(drv,buf);
ret = drv_attr->store(drv,buf,count);
return ret;
}
......@@ -90,14 +91,15 @@ bus_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
}
static ssize_t
bus_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf)
bus_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{
struct bus_attribute * bus_attr = to_bus_attr(attr);
struct bus_type * bus = to_bus(kobj);
ssize_t ret = 0;
if (bus_attr->store)
ret = bus_attr->store(bus,buf);
ret = bus_attr->store(bus,buf,count);
return ret;
}
......
......@@ -26,14 +26,15 @@ devclass_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
}
static ssize_t
devclass_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf)
devclass_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{
struct devclass_attribute * class_attr = to_class_attr(attr);
struct device_class * dc = to_class(kobj);
ssize_t ret = 0;
if (class_attr->store)
ret = class_attr->store(dc,buf);
ret = class_attr->store(dc,buf,count);
return ret;
}
......
......@@ -47,14 +47,15 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
}
static ssize_t
dev_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf)
dev_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{
struct device_attribute * dev_attr = to_dev_attr(attr);
struct device * dev = to_dev(kobj);
ssize_t ret = 0;
if (dev_attr->store)
ret = dev_attr->store(dev,buf);
ret = dev_attr->store(dev,buf,count);
return ret;
}
......
......@@ -24,7 +24,7 @@ device_read_power(struct device * dev, char * page)
}
static ssize_t
device_write_power(struct device * dev, const char * buf)
device_write_power(struct device * dev, const char * buf, size_t count)
{
char str_command[20];
char str_level[20];
......@@ -80,7 +80,7 @@ device_write_power(struct device * dev, const char * buf)
error = 0;
}
done:
return error < 0 ? error : strlen(buf);
return error < 0 ? error : count;
}
static DEVICE_ATTR(power,S_IWUSR | S_IRUGO,
......
......@@ -36,29 +36,27 @@ static ssize_t node_read_cpumap(struct device * dev, char * buf, size_t count, l
static DEVICE_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL);
#define K(x) ((x) << (PAGE_SHIFT - 10))
static ssize_t node_read_meminfo(struct device * dev, char * buf, size_t count, loff_t off)
static ssize_t node_read_meminfo(struct device * dev, char * buf)
{
struct sys_root *node = to_root(dev);
int nid = node->id;
struct sysinfo i;
si_meminfo_node(&i, nid);
return off ? 0 : sprintf(buf, "\n"
"Node %d MemTotal: %8lu kB\n"
"Node %d MemFree: %8lu kB\n"
"Node %d MemUsed: %8lu kB\n"
"Node %d HighTotal: %8lu kB\n"
"Node %d HighFree: %8lu kB\n"
"Node %d LowTotal: %8lu kB\n"
"Node %d LowFree: %8lu kB\n",
nid, K(i.totalram),
nid, K(i.freeram),
nid, K(i.totalram-i.freeram),
nid, K(i.totalhigh),
nid, K(i.freehigh),
nid, K(i.totalram-i.totalhigh),
nid, K(i.freeram-i.freehigh));
return 0;
return sprintf(buf, "\n"
"Node %d MemTotal: %8lu kB\n"
"Node %d MemFree: %8lu kB\n"
"Node %d MemUsed: %8lu kB\n"
"Node %d HighTotal: %8lu kB\n"
"Node %d HighFree: %8lu kB\n"
"Node %d LowTotal: %8lu kB\n"
"Node %d LowFree: %8lu kB\n",
nid, K(i.totalram),
nid, K(i.freeram),
nid, K(i.totalram-i.freeram),
nid, K(i.totalhigh),
nid, K(i.freehigh),
nid, K(i.totalram-i.totalhigh),
nid, K(i.freeram-i.freehigh));
}
#undef K
static DEVICE_ATTR(meminfo,S_IRUGO,node_read_meminfo,NULL);
......
......@@ -69,47 +69,28 @@ struct bus_type mca_bus_type = {
};
EXPORT_SYMBOL (mca_bus_type);
static ssize_t mca_show_pos_id(struct device *dev, char *buf, size_t count,
loff_t off)
static ssize_t mca_show_pos_id(struct device *dev, char *buf)
{
/* four digits, \n and trailing \0 */
char mybuf[6];
struct mca_device *mca_dev = to_mca_device(dev);
int len;
if(mca_dev->pos_id < MCA_DUMMY_POS_START)
len = sprintf(mybuf, "%04x\n", mca_dev->pos_id);
len = sprintf(buf, "%04x\n", mca_dev->pos_id);
else
len = sprintf(mybuf, "none\n");
len++;
if(len > off) {
len = min((size_t)(len - off), count);
memcpy(buf + off, mybuf + off, len);
} else {
len = 0;
}
len = sprintf(buf, "none\n");
return len;
}
static ssize_t mca_show_pos(struct device *dev, char *buf, size_t count,
loff_t off)
static ssize_t mca_show_pos(struct device *dev, char *buf)
{
/* enough for 8 two byte hex chars plus space and new line */
char mybuf[26];
int j, len=0;
struct mca_device *mca_dev = to_mca_device(dev);
for(j=0; j<8; j++)
len += sprintf(mybuf+len, "%02x ", mca_dev->pos[j]);
len += sprintf(buf+len, "%02x ", mca_dev->pos[j]);
/* change last trailing space to new line */
mybuf[len-1] = '\n';
len++;
if(len > off) {
len = min((size_t)(len - off), count);
memcpy(buf + off, mybuf + off, len);
} else {
len = 0;
}
buf[len-1] = '\n';
return len;
}
......
......@@ -284,7 +284,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
}
static ssize_t
pnp_set_current_resources(struct device * dmdev, const char * buf)
pnp_set_current_resources(struct device * dmdev, const char * buf, size_t count)
{
struct pnp_dev *dev = to_pnp_dev(dmdev);
char command[20];
......@@ -326,7 +326,7 @@ pnp_set_current_resources(struct device * dmdev, const char * buf)
goto done;
}
done:
return error < 0 ? error : strlen(buf);
return error < 0 ? error : count;
}
static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR,
......
......@@ -1949,28 +1949,22 @@ dasd_generic_set_offline (struct ccw_device *cdev)
* readonly controls the readonly status of a dasd
*/
static ssize_t
dasd_ro_show(struct device *dev, char *buf, size_t count, loff_t off)
dasd_ro_show(struct device *dev, char *buf)
{
dasd_device_t *device;
if (off)
return 0;
device = dev->driver_data;
if (!device)
return snprintf(buf, count, "n/a\n");
return snprintf(buf, PAGE_SIZE, "n/a\n");
return snprintf(buf, count, device->ro_flag ? "1\n" : "0\n");
return snprintf(buf, PAGE_SIZE, device->ro_flag ? "1\n" : "0\n");
}
static ssize_t
dasd_ro_store(struct device *dev, const char *buf, size_t count, loff_t off)
dasd_ro_store(struct device *dev, const char *buf, size_t count)
{
dasd_device_t *device = dev->driver_data;
if (off)
return 0;
if (device)
device->ro_flag = (buf[0] == '1') ? 1 : 0;
return count;
......@@ -1984,29 +1978,22 @@ static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store);
*/
/* TODO: Implement */
static ssize_t
dasd_use_diag_show(struct device *dev, char *buf, size_t count, loff_t off)
dasd_use_diag_show(struct device *dev, char *buf)
{
dasd_device_t *device;
if (off)
return 0;
device = dev->driver_data;
if (!device)
return snprintf(buf, count, "n/a\n");
return sprintf(buf, "n/a\n");
return snprintf(buf, count, device->use_diag_flag ? "1\n" : "0\n");
return sprintf(buf, device->use_diag_flag ? "1\n" : "0\n");
}
static ssize_t
dasd_use_diag_store(struct device *dev, const char *buf,
size_t count, loff_t off)
dasd_use_diag_store(struct device *dev, const char *buf, size_t count)
{
dasd_device_t *device = dev->driver_data;
if (off)
return 0;
if (device)
device->use_diag_flag = (buf[0] == '1') ? 1 : 0;
return count;
......@@ -2020,43 +2007,38 @@ DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store);
* an inaccaptable interface */
/* TODO: Split this up into smaller files! */
static ssize_t
dasd_devices_show(struct device *dev, char *buf, size_t count, loff_t off)
dasd_devices_show(struct device *dev, char *buf)
{
dasd_device_t *device;
dasd_devmap_t *devmap;
if (off) /* ignore partial write */
return 0;
devmap = NULL;
device = dev->driver_data;
if (device)
devmap = dasd_devmap_from_devno(device->devno);
if (!devmap)
return snprintf(buf, count, "unused\n");
return sprintf(buf, "unused\n");
return min ((size_t) dasd_devices_print(devmap, buf), count);
return min ((size_t) dasd_devices_print(devmap, buf), PAGE_SIZE);
}
static DEVICE_ATTR(dasd, 0444, dasd_devices_show, 0);
#endif
static ssize_t
dasd_discipline_show(struct device *dev, char *buf, size_t count, loff_t off)
dasd_discipline_show(struct device *dev, char *buf)
{
dasd_device_t *device;
if (off)
return 0;
device = dev->driver_data;
if (!device || !device->discipline)
return snprintf(buf, count, "none\n");
return snprintf(buf, count, "%s\n", device->discipline->name);
return sprintf(buf, "none\n");
return snprintf(buf, PAGE_SIZE, "%s\n", device->discipline->name);
}
static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, 0);
static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
static int
dasd_add_sysfs_files(struct ccw_device *cdev)
......
......@@ -185,15 +185,11 @@ ccwgroup_set_offline(struct ccwgroup_device *gdev)
}
static ssize_t
ccwgroup_online_store (struct device *dev, const char *buf, size_t count,
loff_t off)
ccwgroup_online_store (struct device *dev, const char *buf, size_t count)
{
struct ccwgroup_device *gdev;
unsigned int value;
if (off)
return 0;
gdev = to_ccwgroupdev(dev);
if (!dev->driver)
return count;
......@@ -209,16 +205,13 @@ ccwgroup_online_store (struct device *dev, const char *buf, size_t count,
}
static ssize_t
ccwgroup_online_show (struct device *dev, char *buf, size_t count, loff_t off)
ccwgroup_online_show (struct device *dev, char *buf)
{
int online;
if (off)
return 0;
online = (to_ccwgroupdev(dev)->state == CCWGROUP_ONLINE);
return snprintf(buf, count, online ? "1\n" : "0\n");
return sprintf(buf, online ? "1\n" : "0\n");
}
static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store);
......
......@@ -606,30 +606,30 @@ s390_vary_chpid( __u8 chpid, int on)
* Files for the channel path entries.
*/
static ssize_t
chp_status_show(struct device *dev, char *buf, size_t count, loff_t off)
chp_status_show(struct device *dev, char *buf)
{
struct sys_device *sdev = container_of(dev, struct sys_device, dev);
struct channel_path *chp = container_of(sdev, struct channel_path, sdev);
if (!chp)
return off ? 0 : count;
return 0;
switch(chp->state) {
case CHP_OFFLINE:
return off ? 0 : snprintf(buf, count, "n/a\n");
return snprintf(buf, count, "n/a\n");
case CHP_LOGICALLY_OFFLINE:
return off ? 0 : snprintf(buf, count, "logically offline\n");
return snprintf(buf, count, "logically offline\n");
case CHP_STANDBY:
return off ? 0 : snprintf(buf, count, "n/a\n");
return snprintf(buf, count, "n/a\n");
case CHP_ONLINE:
return off ? 0 : snprintf(buf, count, "online\n");
return snprintf(buf, count, "online\n");
default:
return off ? 0 : count;
return 0;
}
}
static ssize_t
chp_status_write(struct device *dev, const char *buf, size_t count, loff_t off)
chp_status_write(struct device *dev, const char *buf, size_t count)
{
struct sys_device *sdev = container_of(dev, struct sys_device, dev);
struct channel_path *cp = container_of(sdev, struct channel_path, sdev);
......@@ -637,9 +637,6 @@ chp_status_write(struct device *dev, const char *buf, size_t count, loff_t off)
int num_args;
int error;
if (off)
return 0;
num_args = sscanf(buf, "%5s", cmd);
if (!num_args)
return count;
......
......@@ -157,7 +157,7 @@ module_exit(cleanup_ccw_bus_type);
* TODO: Split chpids and pimpampom up? Where is "in use" in the tree?
*/
static ssize_t
chpids_show (struct device * dev, char * buf, size_t count, loff_t off)
chpids_show (struct device * dev, char * buf)
{
struct subchannel *sch = to_subchannel(dev);
struct ssd_info *ssd = &sch->ssd_info;
......@@ -168,48 +168,48 @@ chpids_show (struct device * dev, char * buf, size_t count, loff_t off)
ret += sprintf (buf+ret, "%02x ", ssd->chpid[chp]);
ret += sprintf (buf+ret, "\n");
return off ? 0 : min((ssize_t)count, ret);
return min((ssize_t)PAGE_SIZE, ret);
}
static ssize_t
pimpampom_show (struct device * dev, char * buf, size_t count, loff_t off)
pimpampom_show (struct device * dev, char * buf)
{
struct subchannel *sch = to_subchannel(dev);
struct pmcw *pmcw = &sch->schib.pmcw;
return off ? 0 : snprintf (buf, count, "%02x %02x %02x\n",
pmcw->pim, pmcw->pam, pmcw->pom);
return sprintf (buf, "%02x %02x %02x\n",
pmcw->pim, pmcw->pam, pmcw->pom);
}
static ssize_t
devtype_show (struct device *dev, char *buf, size_t count, loff_t off)
devtype_show (struct device *dev, char *buf)
{
struct ccw_device *cdev = to_ccwdev(dev);
struct ccw_device_id *id = &(cdev->id);
if (id->dev_type != 0)
return off ? 0 : snprintf(buf, count, "%04x/%02x\n",
id->dev_type, id->dev_model);
return sprintf(buf, "%04x/%02x\n",
id->dev_type, id->dev_model);
else
return off ? 0 : snprintf(buf, count, "n/a\n");
return sprintf(buf, "n/a\n");
}
static ssize_t
cutype_show (struct device *dev, char *buf, size_t count, loff_t off)
cutype_show (struct device *dev, char *buf)
{
struct ccw_device *cdev = to_ccwdev(dev);
struct ccw_device_id *id = &(cdev->id);
return off ? 0 : snprintf(buf, count, "%04x/%02x\n",
id->cu_type, id->cu_model);
return sprintf(buf, "%04x/%02x\n",
id->cu_type, id->cu_model);
}
static ssize_t
online_show (struct device *dev, char *buf, size_t count, loff_t off)
online_show (struct device *dev, char *buf)
{
struct ccw_device *cdev = to_ccwdev(dev);
return off ? 0 : snprintf(buf, count, cdev->online ? "yes\n" : "no\n");
return sprintf(buf, cdev->online ? "yes\n" : "no\n");
}
void
......@@ -256,14 +256,11 @@ ccw_device_set_online(struct ccw_device *cdev)
}
static ssize_t
online_store (struct device *dev, const char *buf, size_t count, loff_t off)
online_store (struct device *dev, const char *buf, size_t count)
{
struct ccw_device *cdev = to_ccwdev(dev);
unsigned int value;
if (off)
return 0;
if (!cdev->drv)
return count;
......
......@@ -2512,27 +2512,24 @@ ctc_stats(struct net_device * dev)
#define CTRL_BUFSIZE 40
static ssize_t
buffer_show(struct device *dev, char *buf, size_t count, loff_t off)
buffer_show(struct device *dev, char *buf)
{
struct ctc_priv *priv;
priv = dev->driver_data;
if (!priv)
return -ENODEV;
return off ? 0 : snprintf(buf, count, "%d\n",
priv->channel[READ]->max_bufsize);
return sprintf(buf, "%d\n",
priv->channel[READ]->max_bufsize);
}
static ssize_t
buffer_write(struct device *dev, const char *buf, size_t count, loff_t off)
buffer_write(struct device *dev, const char *buf, size_t count)
{
struct ctc_priv *priv;
struct net_device *ndev;
int bs1;
if (off)
return 0;
priv = dev->driver_data;
if (!priv)
return -ENODEV;
......
......@@ -1637,32 +1637,30 @@ lcs_open_device(struct net_device *dev)
* show function for portno called by cat or similar things
*/
static ssize_t
lcs_portno_show (struct device *dev, char *buf, size_t count,
loff_t off)
lcs_portno_show (struct device *dev, char *buf)
{
struct lcs_card *card;
card = (struct lcs_card *)dev->driver_data;
if (off || !card)
if (!card)
return 0;
return snprintf(buf, count, "%d\n", card->portno);
return sprintf(buf, "%d\n", card->portno);
}
/**
* store the value which is piped to file portno
*/
static ssize_t
lcs_portno_store (struct device *dev, const char *buf, size_t count,
loff_t off)
lcs_portno_store (struct device *dev, const char *buf, size_t count)
{
struct lcs_card *card;
int value;
card = (struct lcs_card *)dev->driver_data;
if (off || !card)
if (!card)
return 0;
sscanf(buf, "%u", &value);
......
......@@ -1259,16 +1259,16 @@ netiucv_change_mtu (net_device * dev, int new_mtu)
#define CTRL_BUFSIZE 40
static ssize_t
user_show (struct device *dev, char *buf, size_t count, loff_t off)
user_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%s\n",
netiucv_printname(priv->conn->userid));
return snprintf(buf, PAGE_SIZE, "%s\n",
netiucv_printname(priv->conn->userid));
}
static ssize_t
user_write (struct device *dev, const char *buf, size_t count, loff_t off)
user_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
struct net_device *ndev = container_of((void *)priv, struct net_device, priv);
......@@ -1305,16 +1305,16 @@ user_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(user, 0644, user_show, user_write);
static ssize_t
buffer_show (struct device *dev, char *buf, size_t count, loff_t off)
buffer_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%d\n",
priv->conn->max_buffsize);
return sprintf(buf, "%d\n",
priv->conn->max_buffsize);
}
static ssize_t
buffer_write (struct device *dev, const char *buf, size_t count, loff_t off)
buffer_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
struct net_device *ndev = container_of((void *)priv, struct net_device, priv);
......@@ -1352,38 +1352,37 @@ buffer_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);
static ssize_t
dev_fsm_show (struct device *dev, char *buf, size_t count, loff_t off)
dev_fsm_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%s\n",
fsm_getstate_str(priv->fsm));
return snprintf(buf, PAGE_SIZE, "%s\n",
fsm_getstate_str(priv->fsm));
}
static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL);
static ssize_t
conn_fsm_show (struct device *dev, char *buf, size_t count, loff_t off)
conn_fsm_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%s\n",
fsm_getstate_str(priv->conn->fsm));
return snprintf(buf, PAGE_SIZE, "%s\n",
fsm_getstate_str(priv->conn->fsm));
}
static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL);
static ssize_t
maxmulti_show (struct device *dev, char *buf, size_t count, loff_t off)
maxmulti_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n",
priv->conn->prof.maxmulti);
return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti);
}
static ssize_t
maxmulti_write (struct device *dev, const char *buf, size_t count, loff_t off)
maxmulti_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
......@@ -1394,16 +1393,15 @@ maxmulti_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write);
static ssize_t
maxcq_show (struct device *dev, char *buf, size_t count, loff_t off)
maxcq_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n",
priv->conn->prof.maxcqueue);
return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue);
}
static ssize_t
maxcq_write (struct device *dev, const char *buf, size_t count, loff_t off)
maxcq_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
......@@ -1414,16 +1412,15 @@ maxcq_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write);
static ssize_t
sdoio_show (struct device *dev, char *buf, size_t count, loff_t off)
sdoio_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n",
priv->conn->prof.doios_single);
return sprintf(buf, "%ld\n", priv->conn->prof.doios_single);
}
static ssize_t
sdoio_write (struct device *dev, const char *buf, size_t count, loff_t off)
sdoio_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
......@@ -1434,16 +1431,15 @@ sdoio_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write);
static ssize_t
mdoio_show (struct device *dev, char *buf, size_t count, loff_t off)
mdoio_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n",
priv->conn->prof.doios_multi);
return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi);
}
static ssize_t
mdoio_write (struct device *dev, const char *buf, size_t count, loff_t off)
mdoio_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
......@@ -1454,16 +1450,15 @@ mdoio_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write);
static ssize_t
txlen_show (struct device *dev, char *buf, size_t count, loff_t off)
txlen_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n",
priv->conn->prof.txlen);
return sprintf(buf, "%ld\n", priv->conn->prof.txlen);
}
static ssize_t
txlen_write (struct device *dev, const char *buf, size_t count, loff_t off)
txlen_write (struct device *dev, const char *buf, size_t count)
{
netiucv_priv *priv = dev->driver_data;
......@@ -1474,16 +1469,15 @@ txlen_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write);
static ssize_t
txtime_show (struct device *dev, char *buf, size_t count, loff_t off)
txtime_show (struct device *dev, char *buf)
{
netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n",
priv->conn->prof.tx_time);
return snprintf(buf, count, "%ld\n", priv->conn->prof.tx_time);
}
static ssize_t
txtime_write (struct device *dev, const char *buf, size_t count, loff_t off)
txtime_write (struct device *dev, const char *buf)
{
netiucv_priv *priv = dev->driver_data;
......
......@@ -5325,17 +5325,17 @@ __setup("osst=", osst_setup);
#endif
/* Driverfs file support */
static ssize_t osst_device_kdev_read(struct device *driverfs_dev, char *page, size_t count, loff_t off)
static ssize_t osst_device_kdev_read(struct device *driverfs_dev, char *page)
{
kdev_t kdev;
kdev.value=(int)(long)driverfs_dev->driver_data;
return off ? 0 : sprintf(page, "%x\n",kdev.value);
return sprintf(page, "%x\n",kdev.value);
}
static DEVICE_ATTR(kdev,S_IRUGO,osst_device_kdev_read,NULL);
static ssize_t osst_device_type_read(struct device *driverfs_dev, char *page, size_t count, loff_t off)
static ssize_t osst_device_type_read(struct device *driverfs_dev, char *page)
{
return off ? 0 : sprintf (page, "CHR\n");
return sprintf (page, "CHR\n");
}
static DEVICE_ATTR(type,S_IRUGO,osst_device_type_read,NULL);
......
......@@ -158,12 +158,12 @@ static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL)
show_function(field, format_string) \
\
static ssize_t \
store_##field (struct device *dev, const char *buf) \
store_##field (struct device *dev, const char *buf, size_t count) \
{ \
struct scsi_device *sdev; \
sdev = to_scsi_device(dev); \
snscanf (buf, 20, format_string, &sdev->field); \
return strlen(buf); \
return count; \
} \
static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field)
......@@ -175,7 +175,7 @@ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field)
show_function(field, "%d\n") \
\
static ssize_t \
store_##field (struct device *dev, const char *buf) \
store_##field (struct device *dev, const char *buf, size_t count) \
{ \
int ret; \
struct scsi_device *sdev; \
......@@ -183,7 +183,7 @@ store_##field (struct device *dev, const char *buf) \
if (ret >= 0) { \
sdev = to_scsi_device(dev); \
sdev->field = ret; \
ret = strlen(buf); \
ret = count; \
} \
return ret; \
} \
......
......@@ -3615,19 +3615,17 @@ __setup("st=", st_setup);
#endif
/* Driverfs file support */
static ssize_t st_device_kdev_read(struct device *driverfs_dev,
char *page, size_t count, loff_t off)
static ssize_t st_device_kdev_read(struct device *dev, char *page)
{
kdev_t kdev;
kdev.value=(int)(long)driverfs_dev->driver_data;
return off ? 0 : sprintf(page, "%x\n",kdev.value);
kdev.value=(int)dev->driver_data;
return sprintf(page, "%x\n",kdev.value);
}
static DEVICE_ATTR(kdev,S_IRUGO,st_device_kdev_read,NULL);
static ssize_t st_device_type_read(struct device *driverfs_dev,
char *page, size_t count, loff_t off)
static ssize_t st_device_type_read(struct device *ev, char * page)
{
return off ? 0 : sprintf (page, "CHR\n");
return sprintf (page, "CHR\n");
}
static DEVICE_ATTR(type,S_IRUGO,st_device_type_read,NULL);
......
......@@ -167,14 +167,15 @@ subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
}
static ssize_t
subsys_attr_store(struct kobject * kobj, struct attribute * attr, const char * page)
subsys_attr_store(struct kobject * kobj, struct attribute * attr,
const char * page, size_t count)
{
struct subsystem * s = to_subsys(kobj);
struct subsys_attribute * sattr = to_sattr(attr);
ssize_t ret = 0;
if (sattr->store)
ret = sattr->store(s,page);
ret = sattr->store(s,page,count);
return ret;
}
......@@ -247,7 +248,7 @@ static int flush_read_buffer(struct sysfs_buffer * buffer, char * buf,
error = copy_to_user(buf,buffer->page + *ppos,count);
if (!error)
*ppos += count;
return error ? error : count;
return error ? -EFAULT : count;
}
/**
......@@ -308,7 +309,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count)
if (count >= PAGE_SIZE)
count = PAGE_SIZE - 1;
error = copy_from_user(buffer->page,buf,count);
return error ? error : count;
return error ? -EFAULT : count;
}
......@@ -322,13 +323,14 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count)
* passing the buffer that we acquired in fill_write_buffer().
*/
static int flush_write_buffer(struct file * file, struct sysfs_buffer * buffer)
static int
flush_write_buffer(struct file * file, struct sysfs_buffer * buffer, size_t count)
{
struct attribute * attr = file->f_dentry->d_fsdata;
struct kobject * kobj = file->f_dentry->d_parent->d_fsdata;
struct sysfs_ops * ops = buffer->ops;
return ops->store(kobj,attr,buffer->page);
return ops->store(kobj,attr,buffer->page,count);
}
......@@ -356,7 +358,7 @@ sysfs_write_file(struct file *file, const char *buf, size_t count, loff_t *ppos)
count = fill_write_buffer(buffer,buf,count);
if (count > 0)
count = flush_write_buffer(file,buffer);
count = flush_write_buffer(file,buffer,count);
if (count > 0)
*ppos += count;
return count;
......
......@@ -98,7 +98,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
};
#define BUS_ATTR(_name,_mode,_show,_store) \
......@@ -141,7 +141,7 @@ extern void put_driver(struct device_driver * drv);
struct driver_attribute {
struct attribute attr;
ssize_t (*show)(struct device_driver *, char * buf);
ssize_t (*store)(struct device_driver *, const char * buf);
ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
};
#define DRIVER_ATTR(_name,_mode,_show,_store) \
......@@ -182,7 +182,7 @@ extern void put_devclass(struct device_class *);
struct devclass_attribute {
struct attribute attr;
ssize_t (*show)(struct device_class *, char * buf);
ssize_t (*store)(struct device_class *, const char * buf);
ssize_t (*store)(struct device_class *, const char * buf, size_t count);
};
#define DEVCLASS_ATTR(_name,_str,_mode,_show,_store) \
......@@ -320,7 +320,7 @@ extern void device_release_driver(struct device * dev);
struct device_attribute {
struct attribute attr;
ssize_t (*show)(struct device * dev, char * buf);
ssize_t (*store)(struct device * dev, const char * buf);
ssize_t (*store)(struct device * dev, const char * buf, size_t count);
};
#define DEVICE_ATTR(_name,_mode,_show,_store) \
......
......@@ -166,7 +166,7 @@ static inline void subsys_put(struct subsystem * s)
struct subsys_attribute {
struct attribute attr;
ssize_t (*show)(struct subsystem *, char *);
ssize_t (*store)(struct subsystem *, const char *);
ssize_t (*store)(struct subsystem *, const char *, size_t);
};
extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
......
......@@ -18,7 +18,7 @@ struct attribute {
struct sysfs_ops {
ssize_t (*show)(struct kobject *, struct attribute *,char *);
ssize_t (*store)(struct kobject *,struct attribute *,const char *);
ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
};
extern int
......
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