~ubuntu-branches/ubuntu/trusty/linux-armadaxp/trusty

« back to all changes in this revision

Viewing changes to fs/proc/proc_sysctl.c

  • Committer: Package Import Robot
  • Author(s): Michael Casadevall, Bryan Wu, Dann Frazier, Michael Casadeall
  • Date: 2012-03-10 15:00:54 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120310150054-flugb39zon8vvgwe
Tags: 3.2.0-1600.1
[ Bryan Wu ]
* UBUNTU: import debian/debian.env and debian.armadaxp

[ Dann Frazier ]
* ARM: Armada XP: remove trailing '/' in dirnames in mvRules.mk

[ Michael Casadeall ]
* tools: add some tools for Marvell Armada XP processor
* kernel: timer tick hacking from Marvell
* kernel: Sheeva Errata: add delay on Sheeva when powering down
* net: add Marvell NFP netfilter
* net: socket and skb modifications made by Marvell
* miscdevice: add minor IDs for some Marvell Armada drivers
* fs: introduce memory pool for splice()
* video: EDID detection updates from Marvell Armada XP patchset
* video: backlight: add Marvell Dove LCD backlight driver
* video: display: add THS8200 display driver
* video: framebuffer: add Marvell Dove and Armada XP processor onchip LCD controller driver
* usbtest: add Interrupt transfer testing by Marvell Armada XP code
* usb: ehci: add support for Marvell EHCI controler
* tty/serial: 8250: add support for Marvell Armada XP processor and DeviceTree work
* rtc: add support for Marvell Armada XP onchip RTC controller
* net: pppoe: add Marvell ethernet NFP hook in PPPoE networking driver
* mtd: nand: add support for Marvell Armada XP Nand Flash Controller
* mtd: maps: add Marvell Armada XP specific map driver
* mmc: add support for Marvell Armada XP MMC/SD host controller
* i2c: add support for Marvell Armada XP onchip i2c bus controller
* hwmon: add Kconfig option for Armada XP onchip thermal sensor driver
* dmaengine: add Net DMA support for splice and update Marvell XOR DMA engine driver
* ata: add support for Marvell Armada XP SATA controller and update some quirks
* ARM: add Marvell Armada XP machine to mach-types
* ARM: oprofile: add support for Marvell PJ4B core
* ARM: mm: more ARMv6 switches for Marvell Armada XP
* ARM: remove static declaration to allow compilation
* ARM: alignment access fault trick
* ARM: mm: skip some fault fixing when run on NONE SMP ARMv6 mode during early abort event
* ARM: mm: add Marvell Sheeva CPU Architecture for PJ4B
* ARM: introduce optimized copy operation for Marvell Armada XP
* ARM: SAUCE: hardware breakpoint trick for Marvell Armada XP
* ARM: big endian and little endian tricks for Marvell Armada XP
* ARM: SAUCE: Add Marvell Armada XP build rules to arch/arm/kernel/Makefile
* ARM: vfp: add special handling for Marvell Armada XP
* ARM: add support for Marvell U-Boot
* ARM: add mv_controller_num for ARM PCI drivers
* ARM: add support for local PMUs, general SMP tweaks and cache flushing
* ARM: add Marvell device identifies in glue-proc.h
* ARM: add IPC driver support for Marvell platforms
* ARM: add DMA mapping for Marvell platforms
* ARM: add Sheeva errata and PJ4B code for booting
* ARM: update Kconfig and Makefile to include Marvell Armada XP platforms
* ARM: Armada XP: import LSP from Marvell for Armada XP 3.2 kernel enablement

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 */
4
4
#include <linux/init.h>
5
5
#include <linux/sysctl.h>
 
6
#include <linux/poll.h>
6
7
#include <linux/proc_fs.h>
7
8
#include <linux/security.h>
8
9
#include <linux/namei.h>
14
15
static const struct file_operations proc_sys_dir_file_operations;
15
16
static const struct inode_operations proc_sys_dir_operations;
16
17
 
 
18
void proc_sys_poll_notify(struct ctl_table_poll *poll)
 
19
{
 
20
        if (!poll)
 
21
                return;
 
22
 
 
23
        atomic_inc(&poll->event);
 
24
        wake_up_interruptible(&poll->wait);
 
25
}
 
26
 
17
27
static struct inode *proc_sys_make_inode(struct super_block *sb,
18
28
                struct ctl_table_header *head, struct ctl_table *table)
19
29
{
39
49
                inode->i_fop = &proc_sys_file_operations;
40
50
        } else {
41
51
                inode->i_mode |= S_IFDIR;
42
 
                inode->i_nlink = 0;
 
52
                clear_nlink(inode);
43
53
                inode->i_op = &proc_sys_dir_operations;
44
54
                inode->i_fop = &proc_sys_dir_file_operations;
45
55
        }
176
186
        return proc_sys_call_handler(filp, (void __user *)buf, count, ppos, 1);
177
187
}
178
188
 
 
189
static int proc_sys_open(struct inode *inode, struct file *filp)
 
190
{
 
191
        struct ctl_table *table = PROC_I(inode)->sysctl_entry;
 
192
 
 
193
        if (table->poll)
 
194
                filp->private_data = proc_sys_poll_event(table->poll);
 
195
 
 
196
        return 0;
 
197
}
 
198
 
 
199
static unsigned int proc_sys_poll(struct file *filp, poll_table *wait)
 
200
{
 
201
        struct inode *inode = filp->f_path.dentry->d_inode;
 
202
        struct ctl_table *table = PROC_I(inode)->sysctl_entry;
 
203
        unsigned long event = (unsigned long)filp->private_data;
 
204
        unsigned int ret = DEFAULT_POLLMASK;
 
205
 
 
206
        if (!table->proc_handler)
 
207
                goto out;
 
208
 
 
209
        if (!table->poll)
 
210
                goto out;
 
211
 
 
212
        poll_wait(filp, &table->poll->wait, wait);
 
213
 
 
214
        if (event != atomic_read(&table->poll->event)) {
 
215
                filp->private_data = proc_sys_poll_event(table->poll);
 
216
                ret = POLLIN | POLLRDNORM | POLLERR | POLLPRI;
 
217
        }
 
218
 
 
219
out:
 
220
        return ret;
 
221
}
179
222
 
180
223
static int proc_sys_fill_cache(struct file *filp, void *dirent,
181
224
                                filldir_t filldir,
294
337
        return ret;
295
338
}
296
339
 
297
 
static int proc_sys_permission(struct inode *inode, int mask,unsigned int flags)
 
340
static int proc_sys_permission(struct inode *inode, int mask)
298
341
{
299
342
        /*
300
343
         * sysctl entries that are not writeable,
316
359
        if (!table) /* global root - r-xr-xr-x */
317
360
                error = mask & MAY_WRITE ? -EACCES : 0;
318
361
        else /* Use the permissions on the sysctl table entry */
319
 
                error = sysctl_perm(head->root, table, mask);
 
362
                error = sysctl_perm(head->root, table, mask & ~MAY_NOT_BLOCK);
320
363
 
321
364
        sysctl_head_finish(head);
322
365
        return error;
364
407
}
365
408
 
366
409
static const struct file_operations proc_sys_file_operations = {
 
410
        .open           = proc_sys_open,
 
411
        .poll           = proc_sys_poll,
367
412
        .read           = proc_sys_read,
368
413
        .write          = proc_sys_write,
369
414
        .llseek         = default_llseek,
370
415
};
371
416
 
372
417
static const struct file_operations proc_sys_dir_file_operations = {
 
418
        .read           = generic_read_dir,
373
419
        .readdir        = proc_sys_readdir,
374
420
        .llseek         = generic_file_llseek,
375
421
};