Re: [PATCH] ipc kobject model against 2.6t1

From: Greg KH (greg@kroah.com)
Date: Tue Jul 15 2003 - 13:07:32 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 15 2003 - 22:00:59 EST