mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 20:05:22 +02:00
Revert "eventfs: Create eventfs_root_inode to store dentry"
This reverts commite5c80b2352
which is commitc3137ab631
upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Id15d7f90e6e21d2fc148eb1b2abda5ecaff5aa94 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
117f556b94
commit
5ef5f28bbb
|
@ -35,17 +35,6 @@ static DEFINE_MUTEX(eventfs_mutex);
|
||||||
/* Choose something "unique" ;-) */
|
/* Choose something "unique" ;-) */
|
||||||
#define EVENTFS_FILE_INODE_INO 0x12c4e37
|
#define EVENTFS_FILE_INODE_INO 0x12c4e37
|
||||||
|
|
||||||
struct eventfs_root_inode {
|
|
||||||
struct eventfs_inode ei;
|
|
||||||
struct dentry *events_dir;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct eventfs_root_inode *get_root_inode(struct eventfs_inode *ei)
|
|
||||||
{
|
|
||||||
WARN_ON_ONCE(!ei->is_events);
|
|
||||||
return container_of(ei, struct eventfs_root_inode, ei);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Just try to make something consistent and unique */
|
/* Just try to make something consistent and unique */
|
||||||
static int eventfs_dir_ino(struct eventfs_inode *ei)
|
static int eventfs_dir_ino(struct eventfs_inode *ei)
|
||||||
{
|
{
|
||||||
|
@ -83,18 +72,12 @@ enum {
|
||||||
static void release_ei(struct kref *ref)
|
static void release_ei(struct kref *ref)
|
||||||
{
|
{
|
||||||
struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
|
struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
|
||||||
struct eventfs_root_inode *rei;
|
|
||||||
|
|
||||||
WARN_ON_ONCE(!ei->is_freed);
|
WARN_ON_ONCE(!ei->is_freed);
|
||||||
|
|
||||||
kfree(ei->entry_attrs);
|
kfree(ei->entry_attrs);
|
||||||
kfree_const(ei->name);
|
kfree_const(ei->name);
|
||||||
if (ei->is_events) {
|
kfree_rcu(ei, rcu);
|
||||||
rei = get_root_inode(ei);
|
|
||||||
kfree_rcu(rei, ei.rcu);
|
|
||||||
} else {
|
|
||||||
kfree_rcu(ei, rcu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void put_ei(struct eventfs_inode *ei)
|
static inline void put_ei(struct eventfs_inode *ei)
|
||||||
|
@ -435,43 +418,19 @@ static struct dentry *lookup_dir_entry(struct dentry *dentry,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct eventfs_inode *init_ei(struct eventfs_inode *ei, const char *name)
|
|
||||||
{
|
|
||||||
ei->name = kstrdup_const(name, GFP_KERNEL);
|
|
||||||
if (!ei->name)
|
|
||||||
return NULL;
|
|
||||||
kref_init(&ei->kref);
|
|
||||||
return ei;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct eventfs_inode *alloc_ei(const char *name)
|
static inline struct eventfs_inode *alloc_ei(const char *name)
|
||||||
{
|
{
|
||||||
struct eventfs_inode *ei = kzalloc(sizeof(*ei), GFP_KERNEL);
|
struct eventfs_inode *ei = kzalloc(sizeof(*ei), GFP_KERNEL);
|
||||||
struct eventfs_inode *result;
|
|
||||||
|
|
||||||
if (!ei)
|
if (!ei)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
result = init_ei(ei, name);
|
ei->name = kstrdup_const(name, GFP_KERNEL);
|
||||||
if (!result)
|
if (!ei->name) {
|
||||||
kfree(ei);
|
kfree(ei);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct eventfs_inode *alloc_root_ei(const char *name)
|
|
||||||
{
|
|
||||||
struct eventfs_root_inode *rei = kzalloc(sizeof(*rei), GFP_KERNEL);
|
|
||||||
struct eventfs_inode *ei;
|
|
||||||
|
|
||||||
if (!rei)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
rei->ei.is_events = 1;
|
kref_init(&ei->kref);
|
||||||
ei = init_ei(&rei->ei, name);
|
|
||||||
if (!ei)
|
|
||||||
kfree(rei);
|
|
||||||
|
|
||||||
return ei;
|
return ei;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +719,6 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
|
||||||
int size, void *data)
|
int size, void *data)
|
||||||
{
|
{
|
||||||
struct dentry *dentry = tracefs_start_creating(name, parent);
|
struct dentry *dentry = tracefs_start_creating(name, parent);
|
||||||
struct eventfs_root_inode *rei;
|
|
||||||
struct eventfs_inode *ei;
|
struct eventfs_inode *ei;
|
||||||
struct tracefs_inode *ti;
|
struct tracefs_inode *ti;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
@ -773,7 +731,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
|
||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return ERR_CAST(dentry);
|
return ERR_CAST(dentry);
|
||||||
|
|
||||||
ei = alloc_root_ei(name);
|
ei = alloc_ei(name);
|
||||||
if (!ei)
|
if (!ei)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -782,11 +740,10 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
// Note: we have a ref to the dentry from tracefs_start_creating()
|
// Note: we have a ref to the dentry from tracefs_start_creating()
|
||||||
rei = get_root_inode(ei);
|
ei->events_dir = dentry;
|
||||||
rei->events_dir = dentry;
|
|
||||||
|
|
||||||
ei->entries = entries;
|
ei->entries = entries;
|
||||||
ei->nr_entries = size;
|
ei->nr_entries = size;
|
||||||
|
ei->is_events = 1;
|
||||||
ei->data = data;
|
ei->data = data;
|
||||||
|
|
||||||
/* Save the ownership of this directory */
|
/* Save the ownership of this directory */
|
||||||
|
@ -889,15 +846,13 @@ void eventfs_remove_dir(struct eventfs_inode *ei)
|
||||||
*/
|
*/
|
||||||
void eventfs_remove_events_dir(struct eventfs_inode *ei)
|
void eventfs_remove_events_dir(struct eventfs_inode *ei)
|
||||||
{
|
{
|
||||||
struct eventfs_root_inode *rei;
|
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
|
|
||||||
rei = get_root_inode(ei);
|
dentry = ei->events_dir;
|
||||||
dentry = rei->events_dir;
|
|
||||||
if (!dentry)
|
if (!dentry)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rei->events_dir = NULL;
|
ei->events_dir = NULL;
|
||||||
eventfs_remove_dir(ei);
|
eventfs_remove_dir(ei);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -39,6 +39,7 @@ struct eventfs_attr {
|
||||||
* @children: link list into the child eventfs_inode
|
* @children: link list into the child eventfs_inode
|
||||||
* @entries: the array of entries representing the files in the directory
|
* @entries: the array of entries representing the files in the directory
|
||||||
* @name: the name of the directory to create
|
* @name: the name of the directory to create
|
||||||
|
* @events_dir: the dentry of the events directory
|
||||||
* @entry_attrs: Saved mode and ownership of the @d_children
|
* @entry_attrs: Saved mode and ownership of the @d_children
|
||||||
* @data: The private data to pass to the callbacks
|
* @data: The private data to pass to the callbacks
|
||||||
* @attr: Saved mode and ownership of eventfs_inode itself
|
* @attr: Saved mode and ownership of eventfs_inode itself
|
||||||
|
@ -56,6 +57,7 @@ struct eventfs_inode {
|
||||||
struct list_head children;
|
struct list_head children;
|
||||||
const struct eventfs_entry *entries;
|
const struct eventfs_entry *entries;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
struct dentry *events_dir;
|
||||||
struct eventfs_attr *entry_attrs;
|
struct eventfs_attr *entry_attrs;
|
||||||
void *data;
|
void *data;
|
||||||
struct eventfs_attr attr;
|
struct eventfs_attr attr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user