[lkml]   [2004]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [Patch?] Teach sysfs_get_name not to use a dentry
    Chris Wright wrote:
    >* Adam J. Richter ( wrote:
    >> -static int create_dir(struct kobject * k, struct dentry * p,
    >> - const char * n, struct dentry ** d)
    >> +static int create_dir(void *element, struct dentry * p,
    >> + const char * n, struct dentry ** d, int type)

    >Hmm, I did not look closely, but moving from well-typed to untyped void *
    >doesn't look nice.

    The reason for the change comes from the fact that there are
    two different kinds of directories in a sysfs tree: one representing
    a kobject, and one representing an attribute_group. Previously, both
    types of directories saved a pointer to the kobject (in the case of
    the attribute group, the parent directory is a kobject). Now, however,
    the attribute group saves a pointer to the struct attribute group,
    so that the name of the attribute group can be accessed without
    referencing the dentry. So, the value that create_dir sets
    sysfs_dirent.s_element to really can be to more than one type
    depending on who is calling create_dir (and, by the way,
    sysfs_dirent.s_element is used to point to a few different
    data types, not just these two, and setting sysfs_dirent.s_element
    is the only thing that create_dir does with that parameter).

    You might wonder how an attribute group's kobject is
    determined within sysfs, if we are no longer saving that pointer in
    sysfs_dirent.s_element. It turns out that cases where the parent
    kobject needs to be determined from the attribute group in sysfs
    only occur in when the attribute group's dentry is available, so
    the kobject is available as sysfs_dirent->s_dentry->d_parent->s_fsdata.

    __ ______________
    Adam J. Richter \ / | g g d r a s i l
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 14:08    [W:0.023 / U:12.840 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site