Skip to contentSkip to conversation

ipc kobject model against 2.6t1

PATCH Greg KH 1 participant 1 message Jul 15, 2003

lore
Share & tools
lore

Greg KH

author
#0 lore raw

Some coding style issues:

Review

Quoted 9 lines
(quoted diff) +9 -0
+/*
+ * 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 :)

Quoted 1 line

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

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

Review

Quoted 5 lines
(quoted diff) +5 -0
+	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:

Review

Quoted 13 lines
(quoted diff) +5 -0
+	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.

Review line 349

Quoted 7 lines
(quoted diff) +0 -1
@@ -266,7 +345,6 @@
 		shm_unlock(shp);
 	}
 	up(&shm_ids.sem);
-
 	return err;
 }

Was removing that line really necessary :)

Review line 287

Quoted 6 lines
(quoted diff) +1 -0
@@ -274,6 +283,7 @@
 		vfree(ptr);
 	else
 		kfree(ptr);
+
 }

You added that line why? :)

Hope this helps,

greg k-h