| .. | .. |
|---|
| 14 | 14 | */ |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | #include <linux/atomic.h> |
|---|
| 17 | | -#include <linux/cpufreq_times.h> |
|---|
| 18 | 17 | #include <linux/err.h> |
|---|
| 19 | 18 | #include <linux/hashtable.h> |
|---|
| 20 | 19 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 137 | 136 | |
|---|
| 138 | 137 | /* next the executable file name */ |
|---|
| 139 | 138 | if (mm) { |
|---|
| 140 | | - down_read(&mm->mmap_sem); |
|---|
| 139 | + mmap_write_lock(mm); |
|---|
| 141 | 140 | if (mm->exe_file) { |
|---|
| 142 | 141 | char *pathname = d_path(&mm->exe_file->f_path, buf, |
|---|
| 143 | 142 | unused_len); |
|---|
| .. | .. |
|---|
| 150 | 149 | unused_len--; |
|---|
| 151 | 150 | } |
|---|
| 152 | 151 | } |
|---|
| 153 | | - up_read(&mm->mmap_sem); |
|---|
| 152 | + mmap_write_unlock(mm); |
|---|
| 154 | 153 | } |
|---|
| 155 | 154 | unused_len -= len; |
|---|
| 156 | 155 | |
|---|
| .. | .. |
|---|
| 385 | 384 | return single_open(file, uid_cputime_show, PDE_DATA(inode)); |
|---|
| 386 | 385 | } |
|---|
| 387 | 386 | |
|---|
| 388 | | -static const struct file_operations uid_cputime_fops = { |
|---|
| 389 | | - .open = uid_cputime_open, |
|---|
| 390 | | - .read = seq_read, |
|---|
| 391 | | - .llseek = seq_lseek, |
|---|
| 392 | | - .release = single_release, |
|---|
| 387 | +static const struct proc_ops uid_cputime_fops = { |
|---|
| 388 | + .proc_open = uid_cputime_open, |
|---|
| 389 | + .proc_read = seq_read, |
|---|
| 390 | + .proc_lseek = seq_lseek, |
|---|
| 391 | + .proc_release = single_release, |
|---|
| 393 | 392 | }; |
|---|
| 394 | 393 | |
|---|
| 395 | 394 | static int uid_remove_open(struct inode *inode, struct file *file) |
|---|
| .. | .. |
|---|
| 404 | 403 | struct hlist_node *tmp; |
|---|
| 405 | 404 | char uids[128]; |
|---|
| 406 | 405 | char *start_uid, *end_uid = NULL; |
|---|
| 407 | | - uid_t uid_start = 0, uid_end = 0; |
|---|
| 408 | | - u64 uid; |
|---|
| 406 | + long int uid_start = 0, uid_end = 0; |
|---|
| 409 | 407 | |
|---|
| 410 | 408 | if (count >= sizeof(uids)) |
|---|
| 411 | 409 | count = sizeof(uids) - 1; |
|---|
| .. | .. |
|---|
| 420 | 418 | if (!start_uid || !end_uid) |
|---|
| 421 | 419 | return -EINVAL; |
|---|
| 422 | 420 | |
|---|
| 423 | | - if (kstrtouint(start_uid, 10, &uid_start) != 0 || |
|---|
| 424 | | - kstrtouint(end_uid, 10, &uid_end) != 0) { |
|---|
| 421 | + if (kstrtol(start_uid, 10, &uid_start) != 0 || |
|---|
| 422 | + kstrtol(end_uid, 10, &uid_end) != 0) { |
|---|
| 425 | 423 | return -EINVAL; |
|---|
| 426 | 424 | } |
|---|
| 427 | 425 | |
|---|
| 428 | | - /* Also remove uids from /proc/uid_time_in_state */ |
|---|
| 429 | | - cpufreq_task_times_remove_uids(uid_start, uid_end); |
|---|
| 430 | | - |
|---|
| 431 | 426 | rt_mutex_lock(&uid_lock); |
|---|
| 432 | 427 | |
|---|
| 433 | | - for (uid = uid_start; uid <= uid_end; uid++) { |
|---|
| 428 | + for (; uid_start <= uid_end; uid_start++) { |
|---|
| 434 | 429 | hash_for_each_possible_safe(hash_table, uid_entry, tmp, |
|---|
| 435 | | - hash, uid) { |
|---|
| 436 | | - if (uid == uid_entry->uid) { |
|---|
| 430 | + hash, (uid_t)uid_start) { |
|---|
| 431 | + if (uid_start == uid_entry->uid) { |
|---|
| 437 | 432 | remove_uid_tasks(uid_entry); |
|---|
| 438 | 433 | hash_del(&uid_entry->hash); |
|---|
| 439 | 434 | kfree(uid_entry); |
|---|
| .. | .. |
|---|
| 445 | 440 | return count; |
|---|
| 446 | 441 | } |
|---|
| 447 | 442 | |
|---|
| 448 | | -static const struct file_operations uid_remove_fops = { |
|---|
| 449 | | - .open = uid_remove_open, |
|---|
| 450 | | - .release = single_release, |
|---|
| 451 | | - .write = uid_remove_write, |
|---|
| 443 | +static const struct proc_ops uid_remove_fops = { |
|---|
| 444 | + .proc_open = uid_remove_open, |
|---|
| 445 | + .proc_release = single_release, |
|---|
| 446 | + .proc_write = uid_remove_write, |
|---|
| 452 | 447 | }; |
|---|
| 453 | 448 | |
|---|
| 454 | 449 | |
|---|
| .. | .. |
|---|
| 564 | 559 | return single_open(file, uid_io_show, PDE_DATA(inode)); |
|---|
| 565 | 560 | } |
|---|
| 566 | 561 | |
|---|
| 567 | | -static const struct file_operations uid_io_fops = { |
|---|
| 568 | | - .open = uid_io_open, |
|---|
| 569 | | - .read = seq_read, |
|---|
| 570 | | - .llseek = seq_lseek, |
|---|
| 571 | | - .release = single_release, |
|---|
| 562 | +static const struct proc_ops uid_io_fops = { |
|---|
| 563 | + .proc_open = uid_io_open, |
|---|
| 564 | + .proc_read = seq_read, |
|---|
| 565 | + .proc_lseek = seq_lseek, |
|---|
| 566 | + .proc_release = single_release, |
|---|
| 572 | 567 | }; |
|---|
| 573 | 568 | |
|---|
| 574 | 569 | static int uid_procstat_open(struct inode *inode, struct file *file) |
|---|
| .. | .. |
|---|
| 621 | 616 | return count; |
|---|
| 622 | 617 | } |
|---|
| 623 | 618 | |
|---|
| 624 | | -static const struct file_operations uid_procstat_fops = { |
|---|
| 625 | | - .open = uid_procstat_open, |
|---|
| 626 | | - .release = single_release, |
|---|
| 627 | | - .write = uid_procstat_write, |
|---|
| 619 | +static const struct proc_ops uid_procstat_fops = { |
|---|
| 620 | + .proc_open = uid_procstat_open, |
|---|
| 621 | + .proc_release = single_release, |
|---|
| 622 | + .proc_write = uid_procstat_write, |
|---|
| 628 | 623 | }; |
|---|
| 629 | 624 | |
|---|
| 630 | 625 | static int process_notifier(struct notifier_block *self, |
|---|