On 5/29/2015 10:38 AM, Borislav Petkov wrote:

This one needs to be split in two - the second one adding the readme file...

Ack.

+static ssize_t
+inj_readme_read(struct file *filp, char __user *ubuf,
+                      size_t cnt, loff_t *ppos)
+{
+       return simple_read_from_buffer(ubuf, cnt, ppos,
+                                       readme_msg, strlen(readme_msg));
+}
+
+static const struct file_operations readme_fops = {
+       .read           = inj_readme_read,
+};
+
  static struct dfs_node {
        char *name;
        struct dentry *d;
        const struct file_operations *fops;
+       umode_t perm;
  } dfs_fls[] = {
-       { .name = "status",   .fops = &status_fops },
-       { .name = "misc",     .fops = &misc_fops },
-       { .name = "addr",     .fops = &addr_fops },
-       { .name = "bank",     .fops = &bank_fops },
-       { .name = "flags",    .fops = &flags_fops },
-       { .name = "cpu",      .fops = &extcpu_fops },
+       { .name = "status",   .fops = &status_fops,       S_IRUSR | S_IWUSR },
+       { .name = "misc",     .fops = &misc_fops, S_IRUSR | S_IWUSR },
+       { .name = "addr",     .fops = &addr_fops, S_IRUSR | S_IWUSR },
+       { .name = "bank",     .fops = &bank_fops, S_IRUSR | S_IWUSR },
+       { .name = "flags",    .fops = &flags_fops,        S_IRUSR | S_IWUSR },
+       { .name = "cpu",      .fops = &extcpu_fops,       S_IRUSR | S_IWUSR },
+       { .name = "README",   .fops = &readme_fops,       S_IRUSR | S_IRGRP |
+                                                       S_IROTH },
... and the first one adding perm to struct dfs_node.


Will do.

Thanks,
-Aravind.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to