Skip to contentSkip to conversation

zram: remove zram_sysfs file

PATCH In review Sergey Senozhatsky 2 participants 4 messages Jun 21, 2013 – Jun 22, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zram: remove zram_sysfs file

Move zram sysfs code to zram drv and remove zram_sysfs file. This gives ability to make static a number of previously exported zram functions, used from zram sysfs, e.g. internal zram zram_meta_alloc/free(). We also can drop several zram_drv wrapper functions, used from zram sysfs:
e.g. zram_reset_device()/__zram_reset_device() pair.

---
 drivers/staging/zram/Makefile     |   2 +-
 drivers/staging/zram/zram_drv.c   | 524 +++++++++++++++++++++++++-------------
 drivers/staging/zram/zram_drv.h   |  10 -
 drivers/staging/zram/zram_sysfs.c | 209 ---------------
 4 files changed, 354 insertions(+), 391 deletions(-)
drivers/staging/zram/Makefile +1 -1
index 7f4a301..cb0f9ce 100644
@@ -1,3 +1,3 @@
-zram-y	:=	zram_drv.o zram_sysfs.o
+zram-y	:=	zram_drv.o
 
 obj-$(CONFIG_ZRAM)	+=	zram.o
drivers/staging/zram/zram_drv.c +353 -171

578 lines not on this page · raw message

drivers/staging/zram/zram_drv.h +0 -10
index 11b09fc..9e57bfb 100644
@@ -112,14 +112,4 @@ struct zram {
 
 	struct zram_stats stats;
 };
-
-#ifdef CONFIG_SYSFS
-extern struct attribute_group zram_disk_attr_group;
-#endif
-
-extern void zram_reset_device(struct zram *zram);
-extern struct zram_meta *zram_meta_alloc(u64 disksize);
-extern void zram_meta_free(struct zram_meta *meta);
-extern void zram_init_device(struct zram *zram, struct zram_meta *meta);
-
 #endif
drivers/staging/zram/zram_sysfs.c deleted +0 -209

209 lines not on this page · raw message

#1 lore raw
Quoted 30 lines · Sergey Senozhatsky

Move zram sysfs code to zram drv and remove zram_sysfs file. This gives ability to make static a number of previously exported zram functions, used from zram sysfs, e.g. internal zram zram_meta_alloc/free(). We also can drop several zram_drv wrapper functions, used from zram sysfs:
e.g. zram_reset_device()/__zram_reset_device() pair.

---
 drivers/staging/zram/Makefile     |   2 +-
 drivers/staging/zram/zram_drv.c   | 524 +++++++++++++++++++++++++-------------
 drivers/staging/zram/zram_drv.h   |  10 -
 drivers/staging/zram/zram_sysfs.c | 209 ---------------
 4 files changed, 354 insertions(+), 391 deletions(-)
drivers/staging/zram/Makefile +1 -1
index 7f4a301..cb0f9ce 100644
@@ -1,3 +1,3 @@
-zram-y	:=	zram_drv.o zram_sysfs.o
+zram-y	:=	zram_drv.o
 
 obj-$(CONFIG_ZRAM)	+=	zram.o
drivers/staging/zram/zram_drv.c +0 -0
index ec2b2b5..f32fcca 100644

drivers/staging/zram/zram_drv.c static struct zram *zram_devices; · line 50

Quoted 9 lines
drivers/staging/zram/zram_drv.c +6 -0
@@ -42,6 +42,111 @@ static struct zram *zram_devices;
 /* Module params (documentation at end) */
 static unsigned int num_devices = 1;
 
+module_param(num_devices, uint, 0);
+MODULE_PARM_DESC(num_devices, "Number of zram devices");
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Nitin Gupta <[email protected]>");
+MODULE_DESCRIPTION("Compressed RAM Block Device");

This is usually best put at the bottom of the file, not at the top.

Why did you move it?

thanks,

greg k-h

#2 lore raw
Quoted 42 lines · Greg Kroah-Hartman
Quoted 30 lines

Move zram sysfs code to zram drv and remove zram_sysfs file. This gives ability to make static a number of previously exported zram functions, used from zram sysfs, e.g. internal zram zram_meta_alloc/free(). We also can drop several zram_drv wrapper functions, used from zram sysfs:
e.g. zram_reset_device()/__zram_reset_device() pair.

---
 drivers/staging/zram/Makefile     |   2 +-
 drivers/staging/zram/zram_drv.c   | 524 +++++++++++++++++++++++++-------------
 drivers/staging/zram/zram_drv.h   |  10 -
 drivers/staging/zram/zram_sysfs.c | 209 ---------------
 4 files changed, 354 insertions(+), 391 deletions(-)
drivers/staging/zram/Makefile +1 -1
index 7f4a301..cb0f9ce 100644
@@ -1,3 +1,3 @@
-zram-y	:=	zram_drv.o zram_sysfs.o
+zram-y	:=	zram_drv.o
 
 obj-$(CONFIG_ZRAM)	+=	zram.o
drivers/staging/zram/zram_drv.c +0 -0
index ec2b2b5..f32fcca 100644

drivers/staging/zram/zram_drv.c static struct zram *zram_devices; · line 50

Quoted 9 lines
drivers/staging/zram/zram_drv.c +6 -0
@@ -42,6 +42,111 @@ static struct zram *zram_devices;
 /* Module params (documentation at end) */
 static unsigned int num_devices = 1;
 
+module_param(num_devices, uint, 0);
+MODULE_PARM_DESC(num_devices, "Number of zram devices");
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Nitin Gupta <[email protected]>");
+MODULE_DESCRIPTION("Compressed RAM Block Device");

This is usually best put at the bottom of the file, not at the top.

Quoted 2 lines

Why did you move it?

Hello Greg,
That's a good question, thanks. I was pretty sure that such information is usually put at the top of the file. At least what I saw (to name a few)

arch/ia64/kernel/salinfo.c
drivers/ata/ata_piix.c
drivers/ata/ata_generic.c
drivers/ata/libata-core.c
[..]

MODULE_LICENSE and MODULE_AUTHOR are at the top. Of course I can move it back to original place, will resend soon.

	-ss
Quoted 4 lines

thanks,

greg k-h

#3 lore raw

PATCH 1/1 zram: remove zram_sysfs file (v2)

In reply to Greg Kroah-Hartman

Move zram sysfs code to zram drv and remove zram_sysfs.c file. This gives ability to make static a number of previously exported zram functions, used from zram sysfs, e.g. internal zram zram_meta_alloc/free(). We also can drop zram_drv wrapper functions, used from zram sysfs:
e.g. zram_reset_device()/__zram_reset_device() pair.

v2: as suggested by Greg K-H, move MODULE description to the bottom of the file.

---
 drivers/staging/zram/Makefile     |   2 +-
 drivers/staging/zram/zram_drv.c   | 516 ++++++++++++++++++++++++++------------
 drivers/staging/zram/zram_drv.h   |  10 -
 drivers/staging/zram/zram_sysfs.c | 209 ---------------
 4 files changed, 350 insertions(+), 387 deletions(-)
drivers/staging/zram/Makefile +1 -1
index 7f4a301..cb0f9ce 100644
@@ -1,3 +1,3 @@
-zram-y	:=	zram_drv.o zram_sysfs.o
+zram-y	:=	zram_drv.o
 
 obj-$(CONFIG_ZRAM)	+=	zram.o
drivers/staging/zram/zram_drv.c +349 -167

574 lines not on this page · raw message

drivers/staging/zram/zram_drv.h +0 -10
index 11b09fc..9e57bfb 100644
@@ -112,14 +112,4 @@ struct zram {
 
 	struct zram_stats stats;
 };
-
-#ifdef CONFIG_SYSFS
-extern struct attribute_group zram_disk_attr_group;
-#endif
-
-extern void zram_reset_device(struct zram *zram);
-extern struct zram_meta *zram_meta_alloc(u64 disksize);
-extern void zram_meta_free(struct zram_meta *meta);
-extern void zram_init_device(struct zram *zram, struct zram_meta *meta);
-
 #endif
drivers/staging/zram/zram_sysfs.c deleted +0 -209

209 lines not on this page · raw message