count = 9 - file->f_pos;
if (copy_to_user(buf, buffer + file->f_pos, count))
return -EFAULT;
- file->f_pos += count;
+ *ppos += count;
return count;
}
openprom_property *op;
char buffer[64];
- if (filp->f_pos >= 0xffffff || count >= 0xffffff)
- return -EINVAL;
if (!filp->private_data) {
node = nodes[(u16)((long)inode->u.generic_ip)].node;
i = ((u32)(long)inode->u.generic_ip) >> 16;
op = (openprom_property *)filp->private_data;
if (!count || !(op->len || (op->flag & OPP_ASCIIZ)))
return 0;
+ if (*ppos >= 0xffffff || count >= 0xffffff)
+ return -EINVAL;
if (op->flag & OPP_STRINGLIST) {
for (k = 0, p = op->value; p < op->value + op->len; p++)
if (!*p)
} else {
i = (op->len << 1) + 1;
}
- k = filp->f_pos;
+ k = *ppos;
if (k >= i) return 0;
if (count > i - k) count = i - k;
if (op->flag & OPP_STRING) {
j = count;
if (j >= 0) {
- if (copy_to_user(buf + k - filp->f_pos,
+ if (copy_to_user(buf + k - *ppos,
op->value + k - 1, j))
return -EFAULT;
count -= j;
}
if (count) {
- if (put_user('\'', &buf [k++ - filp->f_pos]))
+ if (put_user('\'', &buf [k++ - *ppos]))
return -EFAULT;
}
if (count > 1) {
- if (put_user('\n', &buf [k++ - filp->f_pos]))
+ if (put_user('\n', &buf [k++ - *ppos]))
return -EFAULT;
}
} else if (op->flag & OPP_STRINGLIST) {
if ((k < i - 1) && (k & 1)) {
sprintf (buffer, "%02x",
(unsigned char) *(op->value + (k >> 1)) & 0xff);
- if (put_user(buffer[1], &buf[k++ - filp->f_pos]))
+ if (put_user(buffer[1], &buf[k++ - *ppos]))
return -EFAULT;
count--;
}
for (; (count > 1) && (k < i - 1); k += 2) {
sprintf (buffer, "%02x",
(unsigned char) *(op->value + (k >> 1)) & 0xff);
- if (copy_to_user(buf + k - filp->f_pos, buffer, 2))
+ if (copy_to_user(buf + k - *ppos, buffer, 2))
return -EFAULT;
count -= 2;
}
if (count && (k < i - 1)) {
sprintf (buffer, "%02x",
(unsigned char) *(op->value + (k >> 1)) & 0xff);
- if (put_user(buffer[0], &buf[k++ - filp->f_pos]))
+ if (put_user(buffer[0], &buf[k++ - *ppos]))
return -EFAULT;
count--;
}
if (count) {
- if (put_user('\n', &buf [k++ - filp->f_pos]))
+ if (put_user('\n', &buf [k++ - *ppos]))
return -EFAULT;
}
}
- count = k - filp->f_pos;
- filp->f_pos = k;
+ count = k - *ppos;
+ *ppos = k;
return count;
}
void *b;
openprom_property *op;
- if (filp->f_pos >= 0xffffff || count >= 0xffffff)
+ if (*ppos >= 0xffffff || count >= 0xffffff)
return -EINVAL;
if (!filp->private_data) {
i = property_read (filp, NULL, 0, NULL);
if (i)
return i;
}
- k = filp->f_pos;
+ k = *ppos;
op = (openprom_property *)filp->private_data;
if (!(op->flag & OPP_STRING)) {
u32 *first, *last;
op->len = i;
} else
op->len = i;
- filp->f_pos += count;
+ *ppos += count;
}
write_try_string:
if (!(op->flag & OPP_BINARY)) {
op->flag |= OPP_QUOTED;
buf++;
count--;
- filp->f_pos++;
+ (*ppos)++;
if (!count) {
op->flag |= OPP_STRING;
return 1;
op->flag |= OPP_NOTQUOTED;
}
op->flag |= OPP_STRING;
- if (op->alloclen <= count + filp->f_pos) {
+ if (op->alloclen <= count + *ppos) {
b = kmalloc (sizeof (openprom_property)
- + 2 * (count + filp->f_pos), GFP_KERNEL);
+ + 2 * (count + *ppos), GFP_KERNEL);
if (!b)
return -ENOMEM;
memcpy (b, filp->private_data,
+ strlen (op->name) + op->alloclen);
memset (((char *)b) + sizeof (openprom_property)
+ strlen (op->name) + op->alloclen,
- 0, 2*(count - filp->f_pos) - op->alloclen);
+ 0, 2*(count - *ppos) - op->alloclen);
op = (openprom_property *)b;
- op->alloclen = 2*(count + filp->f_pos);
+ op->alloclen = 2*(count + *ppos);
b = filp->private_data;
filp->private_data = (void *)op;
kfree (b);
}
- p = op->value + filp->f_pos - ((op->flag & OPP_QUOTED) ? 1 : 0);
+ p = op->value + *ppos - ((op->flag & OPP_QUOTED) ? 1 : 0);
if (copy_from_user(p, buf, count))
return -EFAULT;
op->flag |= OPP_DIRTY;
}
if (i < count) {
op->len = p - op->value;
- filp->f_pos += i + 1;
+ *ppos += i + 1;
if ((p > op->value) && (op->flag & OPP_QUOTED)
&& (*(p - 1) == '\''))
op->len--;
} else {
if (p - op->value > op->len)
op->len = p - op->value;
- filp->f_pos += count;
+ *ppos += count;
}
}
- return filp->f_pos - k;
+ return *ppos - k;
}
int property_release (struct inode *inode, struct file *filp)
return 0;
}
-static struct file_operations openpromfs_prop_ops = {
+static const struct file_operations openpromfs_prop_ops = {
.read = property_read,
.write = property_write,
.release = property_release,
};
-static struct file_operations openpromfs_nodenum_ops = {
+static const struct file_operations openpromfs_nodenum_ops = {
.read = nodenum_read,
};
-static struct file_operations openprom_operations = {
+static const struct file_operations openprom_operations = {
.read = generic_read_dir,
.readdir = openpromfs_readdir,
};
s->s_blocksize_bits = 10;
s->s_magic = OPENPROM_SUPER_MAGIC;
s->s_op = &openprom_sops;
+ s->s_time_gran = 1;
root_inode = iget(s, OPENPROM_ROOT_INO);
if (!root_inode)
goto out_no_root;
unregister_filesystem(&openprom_fs_type);
free_pages ((unsigned long)nodes, alloced);
for (i = 0; i < aliases_nodes; i++)
- if (alias_names [i])
- kfree (alias_names [i]);
+ kfree (alias_names [i]);
nodes = NULL;
}