Skip to contentSkip to conversation

overlayfs: restrict structs visible in current code module

PATCH In review [email protected] 1 participant 2 messages Jan 4, 2016 Overlay filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 overlayfs: restrict structs visible in current code module

From: Zhu Yanjun <[email protected]>

The structs ovl_cache_entry, ovl_dir_cache and ovl_dir_file are only used in the file fs/overlayfs/readdir.c. As such, the static keyword is inserted to define that object to be only visible to the current code module during compilation.

---
 fs/overlayfs/readdir.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/overlayfs/readdir.c +4 -4
index 70e9af5..362bc1c 100644
@@ -17,7 +17,7 @@
 #include <linux/cred.h>
 #include "overlayfs.h"
 
-struct ovl_cache_entry {
+static struct ovl_cache_entry {
 	unsigned int len;
 	unsigned int type;
 	u64 ino;
@@ -28,13 +28,13 @@ struct ovl_cache_entry {
 	char name[];
 };
 
-struct ovl_dir_cache {
+static struct ovl_dir_cache {
 	long refcount;
 	u64 version;
 	struct list_head entries;
 };
 
-struct ovl_readdir_data {
+static struct ovl_readdir_data {
 	struct dir_context ctx;
 	bool is_merge;
 	struct rb_root root;
@@ -45,7 +45,7 @@ struct ovl_readdir_data {
 	int err;
 };
 
-struct ovl_dir_file {
+static struct ovl_dir_file {
 	bool is_real;
 	bool is_upper;
 	struct ovl_dir_cache *cache;
Signature · 1 line
1.7.9.5
author
#1 lore raw

Sorry. Please ignore this patch.

Zhu Yanjun

Quoted 50 lines · On 01/04/2016 05:42 PM, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

The structs ovl_cache_entry, ovl_dir_cache and ovl_dir_file are only used in the file fs/overlayfs/readdir.c. As such, the static keyword is inserted to define that object to be only visible to the current code module during compilation.

---
  fs/overlayfs/readdir.c |    8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
fs/overlayfs/readdir.c +4 -4
index 70e9af5..362bc1c 100644
@@ -17,7 +17,7 @@
  #include <linux/cred.h>
  #include "overlayfs.h"
 
-struct ovl_cache_entry {
+static struct ovl_cache_entry {
  	unsigned int len;
  	unsigned int type;
  	u64 ino;
@@ -28,13 +28,13 @@ struct ovl_cache_entry {
  	char name[];
  };
 
-struct ovl_dir_cache {
+static struct ovl_dir_cache {
  	long refcount;
  	u64 version;
  	struct list_head entries;
  };
 
-struct ovl_readdir_data {
+static struct ovl_readdir_data {
  	struct dir_context ctx;
  	bool is_merge;
  	struct rb_root root;
@@ -45,7 +45,7 @@ struct ovl_readdir_data {
  	int err;
  };
 
-struct ovl_dir_file {
+static struct ovl_dir_file {
  	bool is_real;
  	bool is_upper;
  	struct ovl_dir_cache *cache;