diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/connect.c | 4 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 38 | ||||
-rw-r--r-- | fs/debugfs/file.c | 95 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 2 | ||||
-rw-r--r-- | fs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/minix/inode.c | 34 | ||||
-rw-r--r-- | fs/proc/array.c | 8 | ||||
-rw-r--r-- | fs/proc/stat.c | 63 | ||||
-rw-r--r-- | fs/proc/uptime.c | 11 | ||||
-rw-r--r-- | fs/pstore/inode.c | 3 | ||||
-rw-r--r-- | fs/pstore/platform.c | 36 |
11 files changed, 165 insertions, 131 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index be1e8f91c0a..4666780f315 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -282,7 +282,7 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | |||
282 | byte_count = be32_to_cpu(pTargetSMB->smb_buf_length); | 282 | byte_count = be32_to_cpu(pTargetSMB->smb_buf_length); |
283 | byte_count += total_in_buf2; | 283 | byte_count += total_in_buf2; |
284 | /* don't allow buffer to overflow */ | 284 | /* don't allow buffer to overflow */ |
285 | if (byte_count > CIFSMaxBufSize) | 285 | if (byte_count > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) |
286 | return -ENOBUFS; | 286 | return -ENOBUFS; |
287 | pTargetSMB->smb_buf_length = cpu_to_be32(byte_count); | 287 | pTargetSMB->smb_buf_length = cpu_to_be32(byte_count); |
288 | 288 | ||
@@ -2122,7 +2122,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | |||
2122 | warned_on_ntlm = true; | 2122 | warned_on_ntlm = true; |
2123 | cERROR(1, "default security mechanism requested. The default " | 2123 | cERROR(1, "default security mechanism requested. The default " |
2124 | "security mechanism will be upgraded from ntlm to " | 2124 | "security mechanism will be upgraded from ntlm to " |
2125 | "ntlmv2 in kernel release 3.2"); | 2125 | "ntlmv2 in kernel release 3.3"); |
2126 | } | 2126 | } |
2127 | ses->overrideSecFlg = volume_info->secFlg; | 2127 | ses->overrideSecFlg = volume_info->secFlg; |
2128 | 2128 | ||
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 51352de88ef..a10e428b32b 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1506,35 +1506,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd, | |||
1506 | return -ENOIOCTLCMD; | 1506 | return -ENOIOCTLCMD; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | static void compat_ioctl_error(struct file *filp, unsigned int fd, | ||
1510 | unsigned int cmd, unsigned long arg) | ||
1511 | { | ||
1512 | char buf[10]; | ||
1513 | char *fn = "?"; | ||
1514 | char *path; | ||
1515 | |||
1516 | /* find the name of the device. */ | ||
1517 | path = (char *)__get_free_page(GFP_KERNEL); | ||
1518 | if (path) { | ||
1519 | fn = d_path(&filp->f_path, path, PAGE_SIZE); | ||
1520 | if (IS_ERR(fn)) | ||
1521 | fn = "?"; | ||
1522 | } | ||
1523 | |||
1524 | sprintf(buf,"'%c'", (cmd>>_IOC_TYPESHIFT) & _IOC_TYPEMASK); | ||
1525 | if (!isprint(buf[1])) | ||
1526 | sprintf(buf, "%02x", buf[1]); | ||
1527 | compat_printk("ioctl32(%s:%d): Unknown cmd fd(%d) " | ||
1528 | "cmd(%08x){t:%s;sz:%u} arg(%08x) on %s\n", | ||
1529 | current->comm, current->pid, | ||
1530 | (int)fd, (unsigned int)cmd, buf, | ||
1531 | (cmd >> _IOC_SIZESHIFT) & _IOC_SIZEMASK, | ||
1532 | (unsigned int)arg, fn); | ||
1533 | |||
1534 | if (path) | ||
1535 | free_page((unsigned long)path); | ||
1536 | } | ||
1537 | |||
1538 | static int compat_ioctl_check_table(unsigned int xcmd) | 1509 | static int compat_ioctl_check_table(unsigned int xcmd) |
1539 | { | 1510 | { |
1540 | int i; | 1511 | int i; |
@@ -1621,13 +1592,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | |||
1621 | goto found_handler; | 1592 | goto found_handler; |
1622 | 1593 | ||
1623 | error = do_ioctl_trans(fd, cmd, arg, filp); | 1594 | error = do_ioctl_trans(fd, cmd, arg, filp); |
1624 | if (error == -ENOIOCTLCMD) { | 1595 | if (error == -ENOIOCTLCMD) |
1625 | static int count; | 1596 | error = -ENOTTY; |
1626 | |||
1627 | if (++count <= 50) | ||
1628 | compat_ioctl_error(filp, fd, cmd, arg); | ||
1629 | error = -EINVAL; | ||
1630 | } | ||
1631 | 1597 | ||
1632 | goto out_fput; | 1598 | goto out_fput; |
1633 | 1599 | ||
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index d5016606fb2..f65d4455c5e 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -15,9 +15,11 @@ | |||
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/seq_file.h> | ||
18 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
19 | #include <linux/namei.h> | 20 | #include <linux/namei.h> |
20 | #include <linux/debugfs.h> | 21 | #include <linux/debugfs.h> |
22 | #include <linux/io.h> | ||
21 | 23 | ||
22 | static ssize_t default_read_file(struct file *file, char __user *buf, | 24 | static ssize_t default_read_file(struct file *file, char __user *buf, |
23 | size_t count, loff_t *ppos) | 25 | size_t count, loff_t *ppos) |
@@ -525,3 +527,96 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode, | |||
525 | return debugfs_create_file(name, mode, parent, blob, &fops_blob); | 527 | return debugfs_create_file(name, mode, parent, blob, &fops_blob); |
526 | } | 528 | } |
527 | EXPORT_SYMBOL_GPL(debugfs_create_blob); | 529 | EXPORT_SYMBOL_GPL(debugfs_create_blob); |
530 | |||
531 | #ifdef CONFIG_HAS_IOMEM | ||
532 | |||
533 | /* | ||
534 | * The regset32 stuff is used to print 32-bit registers using the | ||
535 | * seq_file utilities. We offer printing a register set in an already-opened | ||
536 | * sequential file or create a debugfs file that only prints a regset32. | ||
537 | */ | ||
538 | |||
539 | /** | ||
540 | * debugfs_print_regs32 - use seq_print to describe a set of registers | ||
541 | * @s: the seq_file structure being used to generate output | ||
542 | * @regs: an array if struct debugfs_reg32 structures | ||
543 | * @mregs: the length of the above array | ||
544 | * @base: the base address to be used in reading the registers | ||
545 | * @prefix: a string to be prefixed to every output line | ||
546 | * | ||
547 | * This function outputs a text block describing the current values of | ||
548 | * some 32-bit hardware registers. It is meant to be used within debugfs | ||
549 | * files based on seq_file that need to show registers, intermixed with other | ||
550 | * information. The prefix argument may be used to specify a leading string, | ||
551 | * because some peripherals have several blocks of identical registers, | ||
552 | * for example configuration of dma channels | ||
553 | */ | ||
554 | int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | ||
555 | int nregs, void __iomem *base, char *prefix) | ||
556 | { | ||
557 | int i, ret = 0; | ||
558 | |||
559 | for (i = 0; i < nregs; i++, regs++) { | ||
560 | if (prefix) | ||
561 | ret += seq_printf(s, "%s", prefix); | ||
562 | ret += seq_printf(s, "%s = 0x%08x\n", regs->name, | ||
563 | readl(base + regs->offset)); | ||
564 | } | ||
565 | return ret; | ||
566 | } | ||
567 | EXPORT_SYMBOL_GPL(debugfs_print_regs32); | ||
568 | |||
569 | static int debugfs_show_regset32(struct seq_file *s, void *data) | ||
570 | { | ||
571 | struct debugfs_regset32 *regset = s->private; | ||
572 | |||
573 | debugfs_print_regs32(s, regset->regs, regset->nregs, regset->base, ""); | ||
574 | return 0; | ||
575 | } | ||
576 | |||
577 | static int debugfs_open_regset32(struct inode *inode, struct file *file) | ||
578 | { | ||
579 | return single_open(file, debugfs_show_regset32, inode->i_private); | ||
580 | } | ||
581 | |||
582 | static const struct file_operations fops_regset32 = { | ||
583 | .open = debugfs_open_regset32, | ||
584 | .read = seq_read, | ||
585 | .llseek = seq_lseek, | ||
586 | .release = single_release, | ||
587 | }; | ||
588 | |||
589 | /** | ||
590 | * debugfs_create_regset32 - create a debugfs file that returns register values | ||
591 | * @name: a pointer to a string containing the name of the file to create. | ||
592 | * @mode: the permission that the file should have | ||
593 | * @parent: a pointer to the parent dentry for this file. This should be a | ||
594 | * directory dentry if set. If this parameter is %NULL, then the | ||
595 | * file will be created in the root of the debugfs filesystem. | ||
596 | * @regset: a pointer to a struct debugfs_regset32, which contains a pointer | ||
597 | * to an array of register definitions, the array size and the base | ||
598 | * address where the register bank is to be found. | ||
599 | * | ||
600 | * This function creates a file in debugfs with the given name that reports | ||
601 | * the names and values of a set of 32-bit registers. If the @mode variable | ||
602 | * is so set it can be read from. Writing is not supported. | ||
603 | * | ||
604 | * This function will return a pointer to a dentry if it succeeds. This | ||
605 | * pointer must be passed to the debugfs_remove() function when the file is | ||
606 | * to be removed (no automatic cleanup happens if your module is unloaded, | ||
607 | * you are responsible here.) If an error occurs, %NULL will be returned. | ||
608 | * | ||
609 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be | ||
610 | * returned. It is not wise to check for this value, but rather, check for | ||
611 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | ||
612 | * code. | ||
613 | */ | ||
614 | struct dentry *debugfs_create_regset32(const char *name, mode_t mode, | ||
615 | struct dentry *parent, | ||
616 | struct debugfs_regset32 *regset) | ||
617 | { | ||
618 | return debugfs_create_file(name, mode, parent, regset, &fops_regset32); | ||
619 | } | ||
620 | EXPORT_SYMBOL_GPL(debugfs_create_regset32); | ||
621 | |||
622 | #endif /* CONFIG_HAS_IOMEM */ | ||
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 990626e7da8..0b3109ee425 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -281,7 +281,7 @@ static int nodeid_to_addr(int nodeid, struct sockaddr *retaddr) | |||
281 | } else { | 281 | } else { |
282 | struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &addr; | 282 | struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &addr; |
283 | struct sockaddr_in6 *ret6 = (struct sockaddr_in6 *) retaddr; | 283 | struct sockaddr_in6 *ret6 = (struct sockaddr_in6 *) retaddr; |
284 | ipv6_addr_copy(&ret6->sin6_addr, &in6->sin6_addr); | 284 | ret6->sin6_addr = in6->sin6_addr; |
285 | } | 285 | } |
286 | 286 | ||
287 | return 0; | 287 | return 0; |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 1d9b9fcb2db..066836e8184 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -42,7 +42,7 @@ static long vfs_ioctl(struct file *filp, unsigned int cmd, | |||
42 | 42 | ||
43 | error = filp->f_op->unlocked_ioctl(filp, cmd, arg); | 43 | error = filp->f_op->unlocked_ioctl(filp, cmd, arg); |
44 | if (error == -ENOIOCTLCMD) | 44 | if (error == -ENOIOCTLCMD) |
45 | error = -EINVAL; | 45 | error = -ENOTTY; |
46 | out: | 46 | out: |
47 | return error; | 47 | return error; |
48 | } | 48 | } |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index c811c19d31b..fa8b612b8ce 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -262,23 +262,6 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
262 | goto out_no_root; | 262 | goto out_no_root; |
263 | } | 263 | } |
264 | 264 | ||
265 | ret = -ENOMEM; | ||
266 | s->s_root = d_alloc_root(root_inode); | ||
267 | if (!s->s_root) | ||
268 | goto out_iput; | ||
269 | |||
270 | if (!(s->s_flags & MS_RDONLY)) { | ||
271 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | ||
272 | ms->s_state &= ~MINIX_VALID_FS; | ||
273 | mark_buffer_dirty(bh); | ||
274 | } | ||
275 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) | ||
276 | printk("MINIX-fs: mounting unchecked file system, " | ||
277 | "running fsck is recommended\n"); | ||
278 | else if (sbi->s_mount_state & MINIX_ERROR_FS) | ||
279 | printk("MINIX-fs: mounting file system with errors, " | ||
280 | "running fsck is recommended\n"); | ||
281 | |||
282 | /* Apparently minix can create filesystems that allocate more blocks for | 265 | /* Apparently minix can create filesystems that allocate more blocks for |
283 | * the bitmaps than needed. We simply ignore that, but verify it didn't | 266 | * the bitmaps than needed. We simply ignore that, but verify it didn't |
284 | * create one with not enough blocks and bail out if so. | 267 | * create one with not enough blocks and bail out if so. |
@@ -299,6 +282,23 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
299 | goto out_iput; | 282 | goto out_iput; |
300 | } | 283 | } |
301 | 284 | ||
285 | ret = -ENOMEM; | ||
286 | s->s_root = d_alloc_root(root_inode); | ||
287 | if (!s->s_root) | ||
288 | goto out_iput; | ||
289 | |||
290 | if (!(s->s_flags & MS_RDONLY)) { | ||
291 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | ||
292 | ms->s_state &= ~MINIX_VALID_FS; | ||
293 | mark_buffer_dirty(bh); | ||
294 | } | ||
295 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) | ||
296 | printk("MINIX-fs: mounting unchecked file system, " | ||
297 | "running fsck is recommended\n"); | ||
298 | else if (sbi->s_mount_state & MINIX_ERROR_FS) | ||
299 | printk("MINIX-fs: mounting file system with errors, " | ||
300 | "running fsck is recommended\n"); | ||
301 | |||
302 | return 0; | 302 | return 0; |
303 | 303 | ||
304 | out_iput: | 304 | out_iput: |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 3a1dafd228d..8c344f037bd 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -394,8 +394,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
394 | 394 | ||
395 | sigemptyset(&sigign); | 395 | sigemptyset(&sigign); |
396 | sigemptyset(&sigcatch); | 396 | sigemptyset(&sigcatch); |
397 | cutime = cstime = utime = stime = cputime_zero; | 397 | cutime = cstime = utime = stime = 0; |
398 | cgtime = gtime = cputime_zero; | 398 | cgtime = gtime = 0; |
399 | 399 | ||
400 | if (lock_task_sighand(task, &flags)) { | 400 | if (lock_task_sighand(task, &flags)) { |
401 | struct signal_struct *sig = task->signal; | 401 | struct signal_struct *sig = task->signal; |
@@ -423,14 +423,14 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
423 | do { | 423 | do { |
424 | min_flt += t->min_flt; | 424 | min_flt += t->min_flt; |
425 | maj_flt += t->maj_flt; | 425 | maj_flt += t->maj_flt; |
426 | gtime = cputime_add(gtime, t->gtime); | 426 | gtime += t->gtime; |
427 | t = next_thread(t); | 427 | t = next_thread(t); |
428 | } while (t != task); | 428 | } while (t != task); |
429 | 429 | ||
430 | min_flt += sig->min_flt; | 430 | min_flt += sig->min_flt; |
431 | maj_flt += sig->maj_flt; | 431 | maj_flt += sig->maj_flt; |
432 | thread_group_times(task, &utime, &stime); | 432 | thread_group_times(task, &utime, &stime); |
433 | gtime = cputime_add(gtime, sig->gtime); | 433 | gtime += sig->gtime; |
434 | } | 434 | } |
435 | 435 | ||
436 | sid = task_session_nr_ns(task, ns); | 436 | sid = task_session_nr_ns(task, ns); |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 0855e6f2039..d76ca6ae2b1 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -22,29 +22,27 @@ | |||
22 | #define arch_idle_time(cpu) 0 | 22 | #define arch_idle_time(cpu) 0 |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | static cputime64_t get_idle_time(int cpu) | 25 | static u64 get_idle_time(int cpu) |
26 | { | 26 | { |
27 | u64 idle_time = get_cpu_idle_time_us(cpu, NULL); | 27 | u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); |
28 | cputime64_t idle; | ||
29 | 28 | ||
30 | if (idle_time == -1ULL) { | 29 | if (idle_time == -1ULL) { |
31 | /* !NO_HZ so we can rely on cpustat.idle */ | 30 | /* !NO_HZ so we can rely on cpustat.idle */ |
32 | idle = kstat_cpu(cpu).cpustat.idle; | 31 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; |
33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | 32 | idle += arch_idle_time(cpu); |
34 | } else | 33 | } else |
35 | idle = usecs_to_cputime64(idle_time); | 34 | idle = usecs_to_cputime64(idle_time); |
36 | 35 | ||
37 | return idle; | 36 | return idle; |
38 | } | 37 | } |
39 | 38 | ||
40 | static cputime64_t get_iowait_time(int cpu) | 39 | static u64 get_iowait_time(int cpu) |
41 | { | 40 | { |
42 | u64 iowait_time = get_cpu_iowait_time_us(cpu, NULL); | 41 | u64 iowait, iowait_time = get_cpu_iowait_time_us(cpu, NULL); |
43 | cputime64_t iowait; | ||
44 | 42 | ||
45 | if (iowait_time == -1ULL) | 43 | if (iowait_time == -1ULL) |
46 | /* !NO_HZ so we can rely on cpustat.iowait */ | 44 | /* !NO_HZ so we can rely on cpustat.iowait */ |
47 | iowait = kstat_cpu(cpu).cpustat.iowait; | 45 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; |
48 | else | 46 | else |
49 | iowait = usecs_to_cputime64(iowait_time); | 47 | iowait = usecs_to_cputime64(iowait_time); |
50 | 48 | ||
@@ -55,33 +53,30 @@ static int show_stat(struct seq_file *p, void *v) | |||
55 | { | 53 | { |
56 | int i, j; | 54 | int i, j; |
57 | unsigned long jif; | 55 | unsigned long jif; |
58 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; | 56 | u64 user, nice, system, idle, iowait, irq, softirq, steal; |
59 | cputime64_t guest, guest_nice; | 57 | u64 guest, guest_nice; |
60 | u64 sum = 0; | 58 | u64 sum = 0; |
61 | u64 sum_softirq = 0; | 59 | u64 sum_softirq = 0; |
62 | unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; | 60 | unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; |
63 | struct timespec boottime; | 61 | struct timespec boottime; |
64 | 62 | ||
65 | user = nice = system = idle = iowait = | 63 | user = nice = system = idle = iowait = |
66 | irq = softirq = steal = cputime64_zero; | 64 | irq = softirq = steal = 0; |
67 | guest = guest_nice = cputime64_zero; | 65 | guest = guest_nice = 0; |
68 | getboottime(&boottime); | 66 | getboottime(&boottime); |
69 | jif = boottime.tv_sec; | 67 | jif = boottime.tv_sec; |
70 | 68 | ||
71 | for_each_possible_cpu(i) { | 69 | for_each_possible_cpu(i) { |
72 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); | 70 | user += kcpustat_cpu(i).cpustat[CPUTIME_USER]; |
73 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); | 71 | nice += kcpustat_cpu(i).cpustat[CPUTIME_NICE]; |
74 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); | 72 | system += kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; |
75 | idle = cputime64_add(idle, get_idle_time(i)); | 73 | idle += get_idle_time(i); |
76 | iowait = cputime64_add(iowait, get_iowait_time(i)); | 74 | iowait += get_iowait_time(i); |
77 | irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); | 75 | irq += kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; |
78 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); | 76 | softirq += kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; |
79 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); | 77 | steal += kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; |
80 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); | 78 | guest += kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; |
81 | guest_nice = cputime64_add(guest_nice, | 79 | guest_nice += kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
82 | kstat_cpu(i).cpustat.guest_nice); | ||
83 | sum += kstat_cpu_irqs_sum(i); | ||
84 | sum += arch_irq_stat_cpu(i); | ||
85 | 80 | ||
86 | for (j = 0; j < NR_SOFTIRQS; j++) { | 81 | for (j = 0; j < NR_SOFTIRQS; j++) { |
87 | unsigned int softirq_stat = kstat_softirqs_cpu(j, i); | 82 | unsigned int softirq_stat = kstat_softirqs_cpu(j, i); |
@@ -106,16 +101,16 @@ static int show_stat(struct seq_file *p, void *v) | |||
106 | (unsigned long long)cputime64_to_clock_t(guest_nice)); | 101 | (unsigned long long)cputime64_to_clock_t(guest_nice)); |
107 | for_each_online_cpu(i) { | 102 | for_each_online_cpu(i) { |
108 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ | 103 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ |
109 | user = kstat_cpu(i).cpustat.user; | 104 | user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; |
110 | nice = kstat_cpu(i).cpustat.nice; | 105 | nice = kcpustat_cpu(i).cpustat[CPUTIME_NICE]; |
111 | system = kstat_cpu(i).cpustat.system; | 106 | system = kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; |
112 | idle = get_idle_time(i); | 107 | idle = get_idle_time(i); |
113 | iowait = get_iowait_time(i); | 108 | iowait = get_iowait_time(i); |
114 | irq = kstat_cpu(i).cpustat.irq; | 109 | irq = kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; |
115 | softirq = kstat_cpu(i).cpustat.softirq; | 110 | softirq = kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; |
116 | steal = kstat_cpu(i).cpustat.steal; | 111 | steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; |
117 | guest = kstat_cpu(i).cpustat.guest; | 112 | guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; |
118 | guest_nice = kstat_cpu(i).cpustat.guest_nice; | 113 | guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
119 | seq_printf(p, | 114 | seq_printf(p, |
120 | "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu " | 115 | "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu " |
121 | "%llu\n", | 116 | "%llu\n", |
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 766b1d45605..9610ac772d7 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c | |||
@@ -11,15 +11,20 @@ static int uptime_proc_show(struct seq_file *m, void *v) | |||
11 | { | 11 | { |
12 | struct timespec uptime; | 12 | struct timespec uptime; |
13 | struct timespec idle; | 13 | struct timespec idle; |
14 | u64 idletime; | ||
15 | u64 nsec; | ||
16 | u32 rem; | ||
14 | int i; | 17 | int i; |
15 | cputime_t idletime = cputime_zero; | ||
16 | 18 | ||
19 | idletime = 0; | ||
17 | for_each_possible_cpu(i) | 20 | for_each_possible_cpu(i) |
18 | idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle); | 21 | idletime += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE]; |
19 | 22 | ||
20 | do_posix_clock_monotonic_gettime(&uptime); | 23 | do_posix_clock_monotonic_gettime(&uptime); |
21 | monotonic_to_bootbased(&uptime); | 24 | monotonic_to_bootbased(&uptime); |
22 | cputime_to_timespec(idletime, &idle); | 25 | nsec = cputime64_to_jiffies64(idletime) * TICK_NSEC; |
26 | idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); | ||
27 | idle.tv_nsec = rem; | ||
23 | seq_printf(m, "%lu.%02lu %lu.%02lu\n", | 28 | seq_printf(m, "%lu.%02lu %lu.%02lu\n", |
24 | (unsigned long) uptime.tv_sec, | 29 | (unsigned long) uptime.tv_sec, |
25 | (uptime.tv_nsec / (NSEC_PER_SEC / 100)), | 30 | (uptime.tv_nsec / (NSEC_PER_SEC / 100)), |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 379a02dc121..b3b426edb2f 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -80,7 +80,8 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) | |||
80 | { | 80 | { |
81 | struct pstore_private *p = dentry->d_inode->i_private; | 81 | struct pstore_private *p = dentry->d_inode->i_private; |
82 | 82 | ||
83 | p->psi->erase(p->type, p->id, p->psi); | 83 | if (p->psi->erase) |
84 | p->psi->erase(p->type, p->id, p->psi); | ||
84 | 85 | ||
85 | return simple_unlink(dir, dentry); | 86 | return simple_unlink(dir, dentry); |
86 | } | 87 | } |
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 57bbf9078ac..9ec22d3b429 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -122,7 +122,7 @@ static void pstore_dump(struct kmsg_dumper *dumper, | |||
122 | memcpy(dst, s1 + s1_start, l1_cpy); | 122 | memcpy(dst, s1 + s1_start, l1_cpy); |
123 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); | 123 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); |
124 | 124 | ||
125 | ret = psinfo->write(PSTORE_TYPE_DMESG, &id, part, | 125 | ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, |
126 | hsize + l1_cpy + l2_cpy, psinfo); | 126 | hsize + l1_cpy + l2_cpy, psinfo); |
127 | if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) | 127 | if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) |
128 | pstore_new_entry = 1; | 128 | pstore_new_entry = 1; |
@@ -207,8 +207,7 @@ void pstore_get_records(int quiet) | |||
207 | return; | 207 | return; |
208 | 208 | ||
209 | mutex_lock(&psi->read_mutex); | 209 | mutex_lock(&psi->read_mutex); |
210 | rc = psi->open(psi); | 210 | if (psi->open && psi->open(psi)) |
211 | if (rc) | ||
212 | goto out; | 211 | goto out; |
213 | 212 | ||
214 | while ((size = psi->read(&id, &type, &time, &buf, psi)) > 0) { | 213 | while ((size = psi->read(&id, &type, &time, &buf, psi)) > 0) { |
@@ -219,7 +218,8 @@ void pstore_get_records(int quiet) | |||
219 | if (rc && (rc != -EEXIST || !quiet)) | 218 | if (rc && (rc != -EEXIST || !quiet)) |
220 | failed++; | 219 | failed++; |
221 | } | 220 | } |
222 | psi->close(psi); | 221 | if (psi->close) |
222 | psi->close(psi); | ||
223 | out: | 223 | out: |
224 | mutex_unlock(&psi->read_mutex); | 224 | mutex_unlock(&psi->read_mutex); |
225 | 225 | ||
@@ -243,33 +243,5 @@ static void pstore_timefunc(unsigned long dummy) | |||
243 | mod_timer(&pstore_timer, jiffies + PSTORE_INTERVAL); | 243 | mod_timer(&pstore_timer, jiffies + PSTORE_INTERVAL); |
244 | } | 244 | } |
245 | 245 | ||
246 | /* | ||
247 | * Call platform driver to write a record to the | ||
248 | * persistent store. | ||
249 | */ | ||
250 | int pstore_write(enum pstore_type_id type, char *buf, size_t size) | ||
251 | { | ||
252 | u64 id; | ||
253 | int ret; | ||
254 | unsigned long flags; | ||
255 | |||
256 | if (!psinfo) | ||
257 | return -ENODEV; | ||
258 | |||
259 | if (size > psinfo->bufsize) | ||
260 | return -EFBIG; | ||
261 | |||
262 | spin_lock_irqsave(&psinfo->buf_lock, flags); | ||
263 | memcpy(psinfo->buf, buf, size); | ||
264 | ret = psinfo->write(type, &id, 0, size, psinfo); | ||
265 | if (ret == 0 && pstore_is_mounted()) | ||
266 | pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf, | ||
267 | size, CURRENT_TIME, psinfo); | ||
268 | spin_unlock_irqrestore(&psinfo->buf_lock, flags); | ||
269 | |||
270 | return 0; | ||
271 | } | ||
272 | EXPORT_SYMBOL_GPL(pstore_write); | ||
273 | |||
274 | module_param(backend, charp, 0444); | 246 | module_param(backend, charp, 0444); |
275 | MODULE_PARM_DESC(backend, "Pstore backend to use"); | 247 | MODULE_PARM_DESC(backend, "Pstore backend to use"); |