aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorManfred Spraul <manfred@colorfullife.com>2014-01-27 20:07:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 00:02:39 -0500
commit239521f31d7496a5322ee664ed8bbd1027b98c4b (patch)
treeb340031d42d28ebe22edf55a6cf3a6ea0e2c0d99 /ipc/shm.c
parent72a8ff2f9245128c254387c58f948f1f0152ea46 (diff)
ipc: whitespace cleanup
The ipc code does not adhere the typical linux coding style. This patch fixes lots of simple whitespace errors. - mostly autogenerated by scripts/checkpatch.pl -f --fix \ --types=pointer_location,spacing,space_before_tab - one manual fixup (keep structure members tab-aligned) - removal of additional space_before_tab that were not found by --fix Tested with some of my msg and sem test apps. Andrew: Could you include it in -mm and move it towards Linus' tree? Signed-off-by: Manfred Spraul <manfred@colorfullife.com> Suggested-by: Li Bin <huawei.libin@huawei.com> Cc: Joe Perches <joe@perches.com> Acked-by: Rafael Aquini <aquini@redhat.com> Cc: Davidlohr Bueso <davidlohr@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 1bc68f115842..88c59c1e026c 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -67,7 +67,7 @@ static const struct vm_operations_struct shm_vm_ops;
67static int newseg(struct ipc_namespace *, struct ipc_params *); 67static int newseg(struct ipc_namespace *, struct ipc_params *);
68static void shm_open(struct vm_area_struct *vma); 68static void shm_open(struct vm_area_struct *vma);
69static void shm_close(struct vm_area_struct *vma); 69static void shm_close(struct vm_area_struct *vma);
70static void shm_destroy (struct ipc_namespace *ns, struct shmid_kernel *shp); 70static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp);
71#ifdef CONFIG_PROC_FS 71#ifdef CONFIG_PROC_FS
72static int sysvipc_shm_proc_show(struct seq_file *s, void *it); 72static int sysvipc_shm_proc_show(struct seq_file *s, void *it);
73#endif 73#endif
@@ -91,7 +91,7 @@ static void do_shm_rmid(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
91 struct shmid_kernel *shp; 91 struct shmid_kernel *shp;
92 shp = container_of(ipcp, struct shmid_kernel, shm_perm); 92 shp = container_of(ipcp, struct shmid_kernel, shm_perm);
93 93
94 if (shp->shm_nattch){ 94 if (shp->shm_nattch) {
95 shp->shm_perm.mode |= SHM_DEST; 95 shp->shm_perm.mode |= SHM_DEST;
96 /* Do not find it any more */ 96 /* Do not find it any more */
97 shp->shm_perm.key = IPC_PRIVATE; 97 shp->shm_perm.key = IPC_PRIVATE;
@@ -116,7 +116,7 @@ static int __init ipc_ns_init(void)
116 116
117pure_initcall(ipc_ns_init); 117pure_initcall(ipc_ns_init);
118 118
119void __init shm_init (void) 119void __init shm_init(void)
120{ 120{
121 ipc_init_proc_interface("sysvipc/shm", 121 ipc_init_proc_interface("sysvipc/shm",
122#if BITS_PER_LONG <= 32 122#if BITS_PER_LONG <= 32
@@ -248,7 +248,7 @@ static bool shm_may_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
248 */ 248 */
249static void shm_close(struct vm_area_struct *vma) 249static void shm_close(struct vm_area_struct *vma)
250{ 250{
251 struct file * file = vma->vm_file; 251 struct file *file = vma->vm_file;
252 struct shm_file_data *sfd = shm_file_data(file); 252 struct shm_file_data *sfd = shm_file_data(file);
253 struct shmid_kernel *shp; 253 struct shmid_kernel *shp;
254 struct ipc_namespace *ns = sfd->ns; 254 struct ipc_namespace *ns = sfd->ns;
@@ -379,7 +379,7 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
379} 379}
380#endif 380#endif
381 381
382static int shm_mmap(struct file * file, struct vm_area_struct * vma) 382static int shm_mmap(struct file *file, struct vm_area_struct *vma)
383{ 383{
384 struct shm_file_data *sfd = shm_file_data(file); 384 struct shm_file_data *sfd = shm_file_data(file);
385 int ret; 385 int ret;
@@ -486,7 +486,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
486 int error; 486 int error;
487 struct shmid_kernel *shp; 487 struct shmid_kernel *shp;
488 size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 488 size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
489 struct file * file; 489 struct file *file;
490 char name[13]; 490 char name[13];
491 int id; 491 int id;
492 vm_flags_t acctflag = 0; 492 vm_flags_t acctflag = 0;
@@ -512,7 +512,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
512 return error; 512 return error;
513 } 513 }
514 514
515 sprintf (name, "SYSV%08x", key); 515 sprintf(name, "SYSV%08x", key);
516 if (shmflg & SHM_HUGETLB) { 516 if (shmflg & SHM_HUGETLB) {
517 struct hstate *hs; 517 struct hstate *hs;
518 size_t hugesize; 518 size_t hugesize;
@@ -533,7 +533,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
533 } else { 533 } else {
534 /* 534 /*
535 * Do not allow no accounting for OVERCOMMIT_NEVER, even 535 * Do not allow no accounting for OVERCOMMIT_NEVER, even
536 * if it's asked for. 536 * if it's asked for.
537 */ 537 */
538 if ((shmflg & SHM_NORESERVE) && 538 if ((shmflg & SHM_NORESERVE) &&
539 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 539 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
@@ -628,7 +628,7 @@ SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
628 628
629static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version) 629static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version)
630{ 630{
631 switch(version) { 631 switch (version) {
632 case IPC_64: 632 case IPC_64:
633 return copy_to_user(buf, in, sizeof(*in)); 633 return copy_to_user(buf, in, sizeof(*in));
634 case IPC_OLD: 634 case IPC_OLD:
@@ -655,7 +655,7 @@ static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_
655static inline unsigned long 655static inline unsigned long
656copy_shmid_from_user(struct shmid64_ds *out, void __user *buf, int version) 656copy_shmid_from_user(struct shmid64_ds *out, void __user *buf, int version)
657{ 657{
658 switch(version) { 658 switch (version) {
659 case IPC_64: 659 case IPC_64:
660 if (copy_from_user(out, buf, sizeof(*out))) 660 if (copy_from_user(out, buf, sizeof(*out)))
661 return -EFAULT; 661 return -EFAULT;
@@ -680,14 +680,14 @@ copy_shmid_from_user(struct shmid64_ds *out, void __user *buf, int version)
680 680
681static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminfo64 *in, int version) 681static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminfo64 *in, int version)
682{ 682{
683 switch(version) { 683 switch (version) {
684 case IPC_64: 684 case IPC_64:
685 return copy_to_user(buf, in, sizeof(*in)); 685 return copy_to_user(buf, in, sizeof(*in));
686 case IPC_OLD: 686 case IPC_OLD:
687 { 687 {
688 struct shminfo out; 688 struct shminfo out;
689 689
690 if(in->shmmax > INT_MAX) 690 if (in->shmmax > INT_MAX)
691 out.shmmax = INT_MAX; 691 out.shmmax = INT_MAX;
692 else 692 else
693 out.shmmax = (int)in->shmmax; 693 out.shmmax = (int)in->shmmax;
@@ -846,14 +846,14 @@ static int shmctl_nolock(struct ipc_namespace *ns, int shmid,
846 shminfo.shmall = ns->shm_ctlall; 846 shminfo.shmall = ns->shm_ctlall;
847 847
848 shminfo.shmmin = SHMMIN; 848 shminfo.shmmin = SHMMIN;
849 if(copy_shminfo_to_user (buf, &shminfo, version)) 849 if (copy_shminfo_to_user(buf, &shminfo, version))
850 return -EFAULT; 850 return -EFAULT;
851 851
852 down_read(&shm_ids(ns).rwsem); 852 down_read(&shm_ids(ns).rwsem);
853 err = ipc_get_maxid(&shm_ids(ns)); 853 err = ipc_get_maxid(&shm_ids(ns));
854 up_read(&shm_ids(ns).rwsem); 854 up_read(&shm_ids(ns).rwsem);
855 855
856 if(err<0) 856 if (err < 0)
857 err = 0; 857 err = 0;
858 goto out; 858 goto out;
859 } 859 }
@@ -864,7 +864,7 @@ static int shmctl_nolock(struct ipc_namespace *ns, int shmid,
864 memset(&shm_info, 0, sizeof(shm_info)); 864 memset(&shm_info, 0, sizeof(shm_info));
865 down_read(&shm_ids(ns).rwsem); 865 down_read(&shm_ids(ns).rwsem);
866 shm_info.used_ids = shm_ids(ns).in_use; 866 shm_info.used_ids = shm_ids(ns).in_use;
867 shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp); 867 shm_get_stat(ns, &shm_info.shm_rss, &shm_info.shm_swp);
868 shm_info.shm_tot = ns->shm_tot; 868 shm_info.shm_tot = ns->shm_tot;
869 shm_info.swap_attempts = 0; 869 shm_info.swap_attempts = 0;
870 shm_info.swap_successes = 0; 870 shm_info.swap_successes = 0;
@@ -1047,7 +1047,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr,
1047 struct shmid_kernel *shp; 1047 struct shmid_kernel *shp;
1048 unsigned long addr; 1048 unsigned long addr;
1049 unsigned long size; 1049 unsigned long size;
1050 struct file * file; 1050 struct file *file;
1051 int err; 1051 int err;
1052 unsigned long flags; 1052 unsigned long flags;
1053 unsigned long prot; 1053 unsigned long prot;