linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: ffrederick@prov-liege.be
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipc kobject model against 2.6t1
Date: Tue, 15 Jul 2003 11:07:32 -0700	[thread overview]
Message-ID: <20030715180732.GB4495@kroah.com> (raw)

Some coding style issues:


> +/*
> + * sysfs exports
> + */
> +
> +#define SHM_ATTR(_ind, _name)\
> +		shm_ids.entries[id].sysfs_attr[_ind].name=(char*)kmalloc(SYSFS_ATTR_MAX_LENGTH,GFP_KERNEL); \
> +		sprintf(shm_ids.entries[id].sysfs_attr[_ind].name,__stringify(_name)); \
> +		shm_ids.entries[id].sysfs_attr[_ind].mode=0644; \
> +		sysfs_create_file(&shm_ids.entries[id].kobj, &shm_ids.entries[id].sysfs_attr[_ind]); 

At least _try_ to get within 80 columns :)

> +static ssize_t shm_attr_show(struct kobject *kobj, struct attribute *attr, char *buf){

Put '{' on the new line, as Documentation/CodingStyle states to.

> +	unsigned long key=simple_strtoul(kobj->name,NULL,10);
> +	unsigned int id=0;
> +	int found=0;
> +	struct shmid_kernel *shp;
> +	for(id=0;id<=shm_ids.max_id&&!found;id++){

Add an empty line between the variables being defined, and the first
function statement.

Add some spaces in the for() line to look like:
	for (id=0; id<=shm_ids.max_id && !found; id++) {

Same thing for your if () statements:


> +	if(found){


>  void __init shm_init (void)
>  {
>  	ipc_init_ids(&shm_ids, 1);
>  #ifdef CONFIG_PROC_FS
>  	create_proc_read_entry("sysvipc/shm", 0, 0, sysvipc_shm_read_proc, NULL);
>  #endif
> +        strcpy(shm_ids.kobj.name, "shm");
> +        //shm_ids.kobj.parent = &ipc_kobj;	
> +	shm_ids.kobj.parent = NULL;
> +        kobject_register(&shm_ids.kobj);

Use tabs, and not spaces.

> @@ -266,7 +345,6 @@
>  		shm_unlock(shp);
>  	}
>  	up(&shm_ids.sem);
> -
>  	return err;
>  }

Was removing that line really necessary :)


> @@ -274,6 +283,7 @@
>  		vfree(ptr);
>  	else
>  		kfree(ptr);
> +
>  }

You added that line why?  :)

Hope this helps,

greg k-h

             reply	other threads:[~2003-07-15 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-15 18:07 Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-15 14:30 [PATCH] ipc kobject model against 2.6t1 ffrederick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030715180732.GB4495@kroah.com \
    --to=greg@kroah.com \
    --cc=ffrederick@prov-liege.be \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).