dir.c (bd0561c9d8dcbf21cd9aa46c416bbf6a3a12e4b1) | dir.c (c376222960ae91d5ffb9197ee36771aaed1d9f90) |
---|---|
1/* 2 * dir.c - Operations for sysfs directories. 3 */ 4 5#undef DEBUG 6 7#include <linux/fs.h> 8#include <linux/mount.h> --- 23 unchanged lines hidden (view full) --- 32 33/* 34 * Allocates a new sysfs_dirent and links it to the parent sysfs_dirent 35 */ 36static struct sysfs_dirent * __sysfs_new_dirent(void * element) 37{ 38 struct sysfs_dirent * sd; 39 | 1/* 2 * dir.c - Operations for sysfs directories. 3 */ 4 5#undef DEBUG 6 7#include <linux/fs.h> 8#include <linux/mount.h> --- 23 unchanged lines hidden (view full) --- 32 33/* 34 * Allocates a new sysfs_dirent and links it to the parent sysfs_dirent 35 */ 36static struct sysfs_dirent * __sysfs_new_dirent(void * element) 37{ 38 struct sysfs_dirent * sd; 39 |
40 sd = kmem_cache_alloc(sysfs_dir_cachep, GFP_KERNEL); | 40 sd = kmem_cache_zalloc(sysfs_dir_cachep, GFP_KERNEL); |
41 if (!sd) 42 return NULL; 43 | 41 if (!sd) 42 return NULL; 43 |
44 memset(sd, 0, sizeof(*sd)); | |
45 atomic_set(&sd->s_count, 1); 46 atomic_set(&sd->s_event, 1); 47 INIT_LIST_HEAD(&sd->s_children); 48 INIT_LIST_HEAD(&sd->s_sibling); 49 sd->s_element = element; 50 51 return sd; 52} --- 640 unchanged lines hidden --- | 44 atomic_set(&sd->s_count, 1); 45 atomic_set(&sd->s_event, 1); 46 INIT_LIST_HEAD(&sd->s_children); 47 INIT_LIST_HEAD(&sd->s_sibling); 48 sd->s_element = element; 49 50 return sd; 51} --- 640 unchanged lines hidden --- |