linux/lib/kobject.c
<<
>>
Prefs
   1/*
   2 * kobject.c - library routines for handling generic kernel objects
   3 *
   4 * Copyright (c) 2002-2003 Patrick Mochel <mochel@osdl.org>
   5 * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com>
   6 * Copyright (c) 2006-2007 Novell Inc.
   7 *
   8 * This file is released under the GPLv2.
   9 *
  10 *
  11 * Please see the file Documentation/kobject.txt for critical information
  12 * about using the kobject interface.
  13 */
  14
  15#include <linux/kobject.h>
  16#include <linux/string.h>
  17#include <linux/export.h>
  18#include <linux/stat.h>
  19#include <linux/slab.h>
  20
  21/*
  22 * populate_dir - populate directory with attributes.
  23 * @kobj: object we're working on.
  24 *
  25 * Most subsystems have a set of default attributes that are associated
  26 * with an object that registers with them.  This is a helper called during
  27 * object registration that loops through the default attributes of the
  28 * subsystem and creates attributes files for them in sysfs.
  29 */
  30static int populate_dir(struct kobject *kobj)
  31{
  32        struct kobj_type *t = get_ktype(kobj);
  33        struct attribute *attr;
  34        int error = 0;
  35        int i;
  36
  37        if (t && t->default_attrs) {
  38                for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
  39                        error = sysfs_create_file(kobj, attr);
  40                        if (error)
  41                                break;
  42                }
  43        }
  44        return error;
  45}
  46
  47static int create_dir(struct kobject *kobj)
  48{
  49        int error = 0;
  50        error = sysfs_create_dir(kobj);
  51        if (!error) {
  52                error = populate_dir(kobj);
  53                if (error)
  54                        sysfs_remove_dir(kobj);
  55        }
  56        return error;
  57}
  58
  59static int get_kobj_path_length(struct kobject *kobj)
  60{
  61        int length = 1;
  62        struct kobject *parent = kobj;
  63
  64        /* walk up the ancestors until we hit the one pointing to the
  65         * root.
  66         * Add 1 to strlen for leading '/' of each level.
  67         */
  68        do {
  69                if (kobject_name(parent) == NULL)
  70                        return 0;
  71                length += strlen(kobject_name(parent)) + 1;
  72                parent = parent->parent;
  73        } while (parent);
  74        return length;
  75}
  76
  77static void fill_kobj_path(struct kobject *kobj, char *path, int length)
  78{
  79        struct kobject *parent;
  80
  81        --length;
  82        for (parent = kobj; parent; parent = parent->parent) {
  83                int cur = strlen(kobject_name(parent));
  84                /* back up enough to print this name with '/' */
  85                length -= cur;
  86                strncpy(path + length, kobject_name(parent), cur);
  87                *(path + --length) = '/';
  88        }
  89
  90        pr_debug("kobject: '%s' (%p): %s: path = '%s'\n", kobject_name(kobj),
  91                 kobj, __func__, path);
  92}
  93
  94/**
  95 * kobject_get_path - generate and return the path associated with a given kobj and kset pair.
  96 *
  97 * @kobj:       kobject in question, with which to build the path
  98 * @gfp_mask:   the allocation type used to allocate the path
  99 *
 100 * The result must be freed by the caller with kfree().
 101 */
 102char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
 103{
 104        char *path;
 105        int len;
 106
 107        len = get_kobj_path_length(kobj);
 108        if (len == 0)
 109                return NULL;
 110        path = kzalloc(len, gfp_mask);
 111        if (!path)
 112                return NULL;
 113        fill_kobj_path(kobj, path, len);
 114
 115        return path;
 116}
 117EXPORT_SYMBOL_GPL(kobject_get_path);
 118
 119/* add the kobject to its kset's list */
 120static void kobj_kset_join(struct kobject *kobj)
 121{
 122        if (!kobj->kset)
 123                return;
 124
 125        kset_get(kobj->kset);
 126        spin_lock(&kobj->kset->list_lock);
 127        list_add_tail(&kobj->entry, &kobj->kset->list);
 128        spin_unlock(&kobj->kset->list_lock);
 129}
 130
 131/* remove the kobject from its kset's list */
 132static void kobj_kset_leave(struct kobject *kobj)
 133{
 134        if (!kobj->kset)
 135                return;
 136
 137        spin_lock(&kobj->kset->list_lock);
 138        list_del_init(&kobj->entry);
 139        spin_unlock(&kobj->kset->list_lock);
 140        kset_put(kobj->kset);
 141}
 142
 143static void kobject_init_internal(struct kobject *kobj)
 144{
 145        if (!kobj)
 146                return;
 147        kref_init(&kobj->kref);
 148        INIT_LIST_HEAD(&kobj->entry);
 149        kobj->state_in_sysfs = 0;
 150        kobj->state_add_uevent_sent = 0;
 151        kobj->state_remove_uevent_sent = 0;
 152        kobj->state_initialized = 1;
 153}
 154
 155
 156static int kobject_add_internal(struct kobject *kobj)
 157{
 158        int error = 0;
 159        struct kobject *parent;
 160
 161        if (!kobj)
 162                return -ENOENT;
 163
 164        if (!kobj->name || !kobj->name[0]) {
 165                WARN(1, "kobject: (%p): attempted to be registered with empty "
 166                         "name!\n", kobj);
 167                return -EINVAL;
 168        }
 169
 170        parent = kobject_get(kobj->parent);
 171
 172        /* join kset if set, use it as parent if we do not already have one */
 173        if (kobj->kset) {
 174                if (!parent)
 175                        parent = kobject_get(&kobj->kset->kobj);
 176                kobj_kset_join(kobj);
 177                kobj->parent = parent;
 178        }
 179
 180        pr_debug("kobject: '%s' (%p): %s: parent: '%s', set: '%s'\n",
 181                 kobject_name(kobj), kobj, __func__,
 182                 parent ? kobject_name(parent) : "<NULL>",
 183                 kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>");
 184
 185        error = create_dir(kobj);
 186        if (error) {
 187                kobj_kset_leave(kobj);
 188                kobject_put(parent);
 189                kobj->parent = NULL;
 190
 191                /* be noisy on error issues */
 192                if (error == -EEXIST)
 193                        WARN(1, "%s failed for %s with "
 194                             "-EEXIST, don't try to register things with "
 195                             "the same name in the same directory.\n",
 196                             __func__, kobject_name(kobj));
 197                else
 198                        WARN(1, "%s failed for %s (error: %d parent: %s)\n",
 199                             __func__, kobject_name(kobj), error,
 200                             parent ? kobject_name(parent) : "'none'");
 201        } else
 202                kobj->state_in_sysfs = 1;
 203
 204        return error;
 205}
 206
 207/**
 208 * kobject_set_name_vargs - Set the name of an kobject
 209 * @kobj: struct kobject to set the name of
 210 * @fmt: format string used to build the name
 211 * @vargs: vargs to format the string.
 212 */
 213int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
 214                                  va_list vargs)
 215{
 216        const char *old_name = kobj->name;
 217        char *s;
 218
 219        if (kobj->name && !fmt)
 220                return 0;
 221
 222        kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
 223        if (!kobj->name)
 224                return -ENOMEM;
 225
 226        /* ewww... some of these buggers have '/' in the name ... */
 227        while ((s = strchr(kobj->name, '/')))
 228                s[0] = '!';
 229
 230        kfree(old_name);
 231        return 0;
 232}
 233
 234/**
 235 * kobject_set_name - Set the name of a kobject
 236 * @kobj: struct kobject to set the name of
 237 * @fmt: format string used to build the name
 238 *
 239 * This sets the name of the kobject.  If you have already added the
 240 * kobject to the system, you must call kobject_rename() in order to
 241 * change the name of the kobject.
 242 */
 243int kobject_set_name(struct kobject *kobj, const char *fmt, ...)
 244{
 245        va_list vargs;
 246        int retval;
 247
 248        va_start(vargs, fmt);
 249        retval = kobject_set_name_vargs(kobj, fmt, vargs);
 250        va_end(vargs);
 251
 252        return retval;
 253}
 254EXPORT_SYMBOL(kobject_set_name);
 255
 256/**
 257 * kobject_init - initialize a kobject structure
 258 * @kobj: pointer to the kobject to initialize
 259 * @ktype: pointer to the ktype for this kobject.
 260 *
 261 * This function will properly initialize a kobject such that it can then
 262 * be passed to the kobject_add() call.
 263 *
 264 * After this function is called, the kobject MUST be cleaned up by a call
 265 * to kobject_put(), not by a call to kfree directly to ensure that all of
 266 * the memory is cleaned up properly.
 267 */
 268void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
 269{
 270        char *err_str;
 271
 272        if (!kobj) {
 273                err_str = "invalid kobject pointer!r_str = <8a2objeca>                 17goll 04        return error;
 253}
 272        /a> *kobj) {
 177                err_str = "lass="sref">error;
 22goll 04        return error;
 253}
 219        if (kobj->llass="sref">kobj) {
 18226"> 226        ouin ks"comtimes, uskobjby ovlaspan class="comment"> */
 18="sref">kobjEXPORT_SYMBOEL" _ERRhref="+code=lisEL" _ERR class"sref">pr_debug( 1831"> 18226"> 226bug(,s"comt9;t  classrious cawrongin the same direcname!\n", kobj);
 17ame!\n"kobj);
 253}
 206
 147   _init" clasf="+code=kobject_init_internal" class="sref">kobjeame!\n", kobj);
 248    if (kobj *retval *kobj);
 190
        return  190
 222  tf" c href="+code=listf" c ="sref">EXPORT_SYMBOEL" _ERRhref="+code=lisEL" _ERR class"sref">pr_debug(kobj   kobj);
 113  dumptarta href="+code=lisdumptarta ="sreclass="sref">kobj);
 253}
 254EXPORT_SYMBOL(kobj);
 206
 156static int kobject_init(struct kobject *kobj, struct kobjecte(fmt,
 198       ass="sref">kobj, const char * 245        va_list ktype)
 269{
 246        int retval;
 271
 222        retval = kobject_set_name_vargs(kobj, fmt, var 271
 173            kobj) {
 17ame!\n"EXPORT_SYMBOEL" _ERRhref="+code=lisEL" _ERR class"sref">pr_debug("lass="sref">var 271
 135 "> 246        int retval;
 253}
 147   _in (kobj->parent = parent;
 246      t_init"  href="+code=kobject_add_internal" class="sref">kobjame!\n", kobj);
 129}
 190
 211/**
 212 * be pass -an claais - Set tan clmment"> n class="comment">/**
 263/**
 264 * @ket if s"> * change the name of the kobject.
 265 mment * @kobj: poy toe name of the kobject.
 266
 257 * @kobj: pohierarchygers his name of the kobject.
 258 e name of the kobject.
 119
 240 * chn claent"> bebj: st>/* e name of the kobject.
 261 * chn claent"> bebj: st>/u have already added the
 212 * be  212ocitempted t * @kss= assign you"> *r to the kt nameno e=ksete already added the
 263 * @kobj: pis fun * @kkobj: poy "> beblocatempers haete already added the
 264 * chlass= treee name of the kobject.
 265
 266 *5 smref=erro,class="commentct to ed, er thect_rename() in order to
 257 the n class="co212ociatempted t * @nge the name of the kobject.
 258  name of the kobject.
 259ilizekobjt">klass="ce name of the kobject.
 260 *
 131 * regist Ifregist ="srefoy "> bebce_dirmpted t * After is fun er trhlhouat =ksete already added the
 212
 263 to kfree di cleaned up by a call
 234 e name of the kobject.
 235 */
 156static int kobject_init(struct kobject *kobj, struct kobjecte(fmt,
 17ass="sref">kobj, const char *fmt, ...)
kobj) {
 139        va_lis/a>, vargs;
 246        int retval;
 271
 272        if (! 271
 187                return -EINVAL;
 184
 145        if (!kobj->llass="sref">kobj) {
 14ame!\n"EXPORT_SYMBOEL" _ERRhref="+code=lisEL" _ERR class"sref">pr_debug("kobject: '&ug<="commn clrefregister things with "
 1746"> 14a"sref">pr_debug(
 198  "> 156static int  272        if (!, kobj);
 189          dumptarta href="+code=lisdumptarta ="sreclass="sref">kobj);
 220                return -EINVAL;
 129}
 152        va_star/a>, vargs, fmt);
 113        retval = (kobje(kobj, fmt/a>, fmt);
 152        va_en/a>, fmt);
 255
 246        int retval;
 129}
 254EXPORT_SYMBOL(fmt);
 229
 260/**
 261 * kobject_init - initializ and  Ife a u"> * @kobj: pohierarchyn class="comment">/**
 262 * @kobj: pointer to the kobject to initialize
 263 * @ktype: pointer to the ktype for this kobject.
 264 * @ket if s"> * r to the ktype for this kobject.
 265 * change the name of the kobject.
 266
 267 208 ment">handl;t  a clasobject_pu name of the kobject.
 259
 260 */
 156static int kobject_init(struct kobject *kobj, struct kobj_type *
 18888888888ass="sref">kobj, struct kobjecte(kobj, const char *fmt, ...)
kobj) {
     3           152        va_lis/a>, vargs;
 246        int retval;
 206
 147   _init" clas=kobject_add_internal" class="srt_set_name_vargs(kobj /a> *retval;
 218
 139        va_star/a>, vargs, fmt);
 180        retval = (kobje(kobj, fmt/a>, fmt);
 152        va_en/a>, fmt);
fmt);
 246        int retval;
 253}
 254EXPORT_SYMBOL(fmt);
 206
 207/**
 208 me=bject" cclass="comment">/**
 209 e name of the kobject.
 210
 261
 262 * ch er trhn cprovide mutuae cleaned up by a call
 263 n class=ou mus cleaned up by a call
 264
 265&quoassfli poy to ouotrskobj: pse name of the kobject.
 266 */
 156static int kobject_set_name(struct kobject *kobj, const new s="s * 271
kobj) {
 156stati  if (        return 0;
kobj, const devpathhref="+code=lisdevpath" class="sref">retvalretval;
kobj, const dup s="s *retvalkobj, const n="s *name;
kobj, const devpath_bugref="+code=lisdevpath_bugretvalretval;
 270        cnvp(retval;
 184
kobject *retval = fmt);
 272        (fmt);
 170                return -EINVAL;
 145        if (!kobj(EINVAL;
 180                return -EINVAL;
 190
 152  devpathhref="+code=lisdevpath" class="sref">retvalkobjf(fmt);
 272       devpathhref="+code=lisdevpath" clllass="sref">kobj) {
 273             f (ENOMEM;
 21goll 04        rou(ENOMEM;
 253}
retval((kobjf(fmt);
 272       devpath_bugref="+code=lisdevpath_bugkobj) {
 228             f (ENOMEM;
 18goll 04        rou(ENOMEM;
 253}
 152   = kvasprintdevpath_bugref="+code=lisdevpath_bugname, "he same direcname!\n"ENOMEM;
 222  cnvp(kvasprintdevpath_bugref="+code=lisdevpath_bugENOMEM;
 113  cnvp(kvasprinte=NUhref="+code=lise=NU" class="sref">retval;
 184
kobjectn="s *kvasprintdup s="s *retval(kvasprintnew s="s *kobjf(fmt);
 272       n="s *kobj) {
 177             f (ENOMEM;
 22goll 04        rou(ENOMEM;
 253}
 190
 152     f ( 152   ass= ou mus_di (kobjnew s="s *ENOMEM;
 152     f (EINVAL;
 27goll 04        rou(ENOMEM;
 184
 226         */
retvalkobjname;
 147   _in (kobjkvasprintn="s *name;
 218
 226         * Afmostly/only* @fmtpoinnetwork ommenfacee name of the kobject.
 240
 241 */
 222  ternal" ="sref_=nvhref="+code=listernal" ="sref_=nvs="srt_set_name_vargs(kobjKOBJ_MOVE>(kobjcnvp(ENOMEM;
ENOMEM;
 2ou( 190
 245  (), n>(kvasprintdup s="s *ENOMEM;
kvasprintdevpath_bugref="+code=lisdevpath_bugENOMEM;
 147   ), n>(kvasprintdevpathhref="+code=lisdevpath" cllass="sref">ENOMEM;
 248  ternal" pu(fmt);
 229
 246      eturn error;
 253}
EXPORT_SYMBOL(fmt);
ENOMEM;
 264/**
 265/**
 256 e name of the kobject.
 257
 258 */
 156static int kobject_init(struct kobject *kobj, struct kobjectnew #37;s  *EINVAL;
kobj) {
 156stati  if (fmt);
kobj, struct kobjectold #37;s  *fmt);
kobj, const devpathhref="+code=lisdevpath" class="sref">retvalretval;
kobj, const devpath_bugref="+code=lisdevpath_bugretvalretval;
kobj, const cnvp(retval;
 206
 147   _in (retval = fmt);
 145        if (!EINVAL;
 180                return -EINVAL;
 180  new #37;s  *retval = EINVAL;
 145       new #37;s  *kobj) {
 18219"> 219        if (kobj(EINVAL;
 27 name="L180"> 180  new #37;s  *retval = kobjkobj(kobj(fmt);
     4           253}
 226         */
retvalkobjf(fmt);
 272       devpathhref="+code=lisdevpath" clllass="sref">kobj) {
 227             f (ENOMEM;
 18goll 04        rou(ENOMEM;
 253}
 152  devpath_bugref="+code=lisdevpath_bugretval((kobjf( 253}
 272       devpath_bugref="+code=lisdevpath_bugkobj) {
 187             f (ENOMEM;
 17goll 04        rou(ENOMEM;
 253}
kvasprintdevpath_bugref="+code=lisdevpath_bugname, "he same direcname!\n"ENOMEM;
 147  cnvp(kvasprintdevpath_bugref="+code=lisdevpath_bugENOMEM;
 248  cnvp(kvasprinte=NUhref="+code=lise=NU" class="sref">retval;
 139     f ( 152   ass= movs_di (kobjnew #37;s  *EINVAL;
 139     f (EINVAL;
 17goll 04        rou(ENOMEM;
 222  old #37;s  *retvalkobj = parent;
 113  kif (!kobj = kvasprintnew #37;s  *parent;
 152  new #37;s  *retvalretval;
kobjectal" pu(EINVAL;
(kobjKOBJ_MOVE>(kobjcnvp(ENOMEM;
        rou( 190
 248  ternal" pu(EINVAL;
 139  ternal" pu(fmt);
 180  (), n>(kvasprintdevpath_bugref="+code=lisdevpath_bugENOMEM;
 152   ), n>(kvasprintdevpathhref="+code=lisdevpath" cllass="sref">ENOMEM;
 246      eturn error;
 253}
 184
 265/**
 256
 257
 258 */
 139  ternal" delkobject_init(struct kobject *EINVAL;
kobj) {
 145        *EINVAL;
 185 lass="sref">error;
ENOMEM;
 152  sass= oumovs_di (fmt);
kobject(!kobj((fmt);
 147   _init" pu(kobj(fmt);
 248  tern(!kobj = kvasprinte=NUhref="+code=lise=NU" class="sref">retval;
 253}
 190
 261/**
 212 * be  ges -at"coumif smencouf spoinobj: pe name of the kobject.
 263
 264 */
kobject_init(struct kobject= kobject_init(struct kobject *EINVAL;
kobj) {
kobject *EINVAL;
 22="sref">kobjectkobjkobjfmt);
 246      e if (fmt);
 253}
 271
 212/**
 263
 234
 235 */
 139  ternal" cleanup=kobject_add_internal" cleanup n"sref">kobject_init(struct kobject *EINVAL;
kobj) {
kobj, struct kobj_typekvasprintges_ /a> *(fmt);
kobj, const n="s *kvasprinte if (kobjname;
 190
 152  pr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug("kobject: '&>"n the same direcgs with "
 18L139"> 139  ternal"  mus=kobject_add_internal" naname" > 272        if (!, fmt);
ENOMEM;
kobject 145       kobjEINVAL;
 152  pr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug("kobject: '&does not havjectreleass()fregister things with "
 14L name="L1"sref">pr_debug( ,e a is brokenoand mu="sbe fixedin the same direcgs with "
 1746"> 148L139"> 139  ternal"  mus=kobject_add_internal" naname" > 272        if (!, fmt);
 218
 226         */
 139  (!kobj 145       (!kobjkobj) {
 17152"> 152  pr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug("kobject: '&auto cleanuptring"oumovstkobje"srefn the same direcgs with "
 18888888888139"> 139  ternal"  mus=kobject_add_internal" naname" > 272        if (!, fmt);
 187          ternal" ="srefhref="+code=listernal" ="srefs="srt_set_name_vargs(kobjKOBJ_REMOVE>(fmt);
 253}
 255
 226         */
kobject *kobj(kobj) {
 22="sref">kobjectpr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug("kobject: '&auto cleanuptternal" deln the same direcgs with "
 18888888888139"> 139  ternal"  mus=kobject_add_internal" naname" > 272        if (!, fmt);
 187          ternal" delfmt);
 253}
fmt);
kobject       kobjkobj) {
 22="sref">kobjectpr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug("kobject: '& er ;t   /a> treleassn the same direcgs with "
 139  ternal"  mus=kobject_add_internal" naname" > 272        if (!, fmt);
 14 145       kobj, fmt);
 253}
 218
 226         */
 139  n="s *kobj) {
 17152"> 152  pr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug("kobj:a), n@="L2n the same direcasref">kvasprintn="s *fmt);
 18ame!\n"(kvasprintn="s *fmt);
 253}
     5           253}
 255
 139  ternal" releass=kobject_add_internal" releass n"sref">kobject_init(str+cokobject_add_intef"" clss="sref">kobjectEINVAL;
kobj) {
 248  ternal" cleanup=kobject_add_internal" cleanup n"sr248"> 248  conta8" r_ocokobject_add_inconta8" r_ocbj" "ame!\n"kobj, struct fmt);
 253}
 190
 261/**
 212 * be  pus -adecoumif smencouf spoinobj: pe name of the kobject.
 263
 234
 265
 266 */
 139  ternal" pu(kobject_init(struct kobject *EINVAL;
kobj) {
kobject *kobj) {
 18145"> 145        if (!kobj(EINVAL;
 17 name="L248"> 248  WARN>(kobjKERN_WARNING>(pr_debug("kobject: '&is not register things with "
 18888888888ame="L126"> 226bug( * be  pus() is be;t  register things with "
 27 name="L8ame="L126"> 226bug( 139  ternal"  mus=kobject_add_internal" naname" > 272        if (!, fmt);
 22="sref">kobjecttef"apu(&s="sref">kobjkobj 139  ternal" releass=kobject_add_internal" releass n"s class="sref">fmt);
 253}
 253}
 253}
 139  dy="Lic_53kobject_init(struct kobject *EINVAL;
kobj) {
 180  pr_debua>ref="+code=lispr_debuas="srt"sref">pr_debug(fmt);
 152   ), n>(kvasprintpan>, fmt);
 253}
ENOMEM;
kobj, struct  139  dy="Lic_53 * lass==lass="sref">kobj) {
kobjkvasprintdy="Lic_53
kobj(kobj(
fmt);
 218
 261/**
 240/**
 241/**
 212 *creizes a lass="c ass="sure dy="Licer yoand setse a up name of the kobject.
 263 *set upe name of the kobject.
 234
 265 256 tdofromohere mu="sbe cleantdoup with a name of the kobject.
 257
 258 261 */
kobject_init(struct kobject= EINVAL;
kobj) {
kobj, struct kobjectpan>, fmt);
ENOMEM;
 152  pan>, kvasprintezer oc>(kobject *kobjf( 253}
 145        *EINVAL;
 145 "> 246      e=NUhref="+code=lise=NU" class="sref">retval;
 253}
 248  ternal" " it=kobject_add_internal" " itass="sref">kvasprintpan>, kobj * lass cname="L253"> 253}
 246      e if (fmt);
 253}
 271
 212
 263
 234
 235
 256 257
 258 *creizes a lass="c ass="sure dy="Licer yoand registerse a name of the kobject.
 261 240
 241
 212
 263 264 */
kobject_init(struct kobject= kobj, const n="s *kobj, struct kobjecte( */
kobj) {
kobj, struct kobjectpan>, fmt);
 156stati5fmt);
 229
 180  (an>, kvasprinte/a>=  253}
 145        *EINVAL;
 185 "> 246      e=NUhref="+code=lise=NU" class="sref">retval;
ENOMEM;
 152  5kvasprinte/a>= (name, "he same direcname!\n"fmt);
 152  5kobj) {
 14 145       tf" ck>ref="+code=lispr" ckass="ame!\n"(pr_debug(": ternal"  hr =erro;&>&quodn the same direcgs with "
 1746"> 14ame!\n"fmt);
 22="sref">kobjectk * be  pus=kobject_add_internal" pu(s="srt_set_name_vargs(fmt);
 18180"> 180  (an>, kvasprinte=NUhref="+code=lise=NU" class="sref">retval;
 253}
 246      e if (fmt);
 253}
 246      EXPORT_SYMBOL_GP-fmt);
 184
 265/**
 256/**
 257/**
 258 */
 139  tbet_" it=kobject_add_intbet_" its="sref">kobject_init(st=ks>(kobjectp>(EINVAL;
kobj) {
 152   ernal" " it " ternalkobj(kobj(fmt);
 222  INIT_LIST_HEAD>(kobj(kobj(fmt);
 113  spin_lock_" it=kobject_add_inspin_lock_" its="sr&s="sref">kobj(kobj(fmt);
 253}
 255
 256 sspan class="comment"> */
 113  ssize_t=kobject_add_inssize_tine" t"sref">kobj(kobject_init(struct kobjectpan>, kobj, satugkobjectatug,  */
 2222222222222222ref">kobj, const bucokobject_add_inbucbj" ass="sref">EINVAL;
kobj) {
kobj, structatugkobjectpatug, fmt);
 152  ssize_t=kobject_add_inssize_tine" t"sref">kobj(fmt);
fmt);
 113  katug, kvasprintconta8" r_ocokobject_add_inconta8" r_ocbj" "ame!\n"kobj, structatugfmt);
kobjectkobj(EINVAL;
 113  rks>(kobjectkobj(, fmt);
 246      rks>(fmt);
 253}
 218
 113  ssize_t=kobject_add_inssize_tine" t"sref">kobjkobject_init(struct kobjectpan>, kobj, satugkobjectatug,  */
 18222222222222222rss="sref">kobj, const bucokobject_add_inbucbj" cname!\n"kobj */
kobj) {
kobj, structatugkobjectpatug, fmt);
 113  ssize_t=kobject_add_inssize_tine" t"sref">kobj(fmt);
 184
kobjectkvasprintconta8" r_ocokobject_add_inconta8" r_ocbj" "ame!\n"kobj, structatug 184
kobjectkobj */
 17113"> 113  rks>(kobjectkobj,  184
 246      rks>(fmt);
 253}
 190
kobj, ssass= op=>(kobj, structsass= op=>(kobj) {
kobj(kvasprinte if_atug_show>( */
kobjkvasprinte if_atug_store,  */
fmt);
 255
 256/**
 257
 258
 261 */
 156statitbet_register=kobject_add_intbet_registers="sref">kobject_init(st=ks>(kobjectp>(EINVAL;
kobj) {
 156statierr=kobject_add_inerr" clclass="sref">fmt);
ENOMEM;
 145       <>(EINVAL;
 "              retINVA-fmt);
fmt);
 147   bet_" it=kobject_add_intbet_" its="sr 145       <>(fmt);
 248  err=kobject_add_inerr" clclasref">kvasprinte/a>= kobj(kobj(fmt);
kobjecterr=kobject_add_inerr" class="sref">EINVAL;
 185 "> 246      err=kobject_add_inerr" clclass="sref">fmt);
 152   ernal" ="srefhref="+code=listernal" ="srefs="sr&s="sref">kobj(kobj(kobjKOBJ_ADD>(fmt);
fmt);
 253}
 184
 265/**
 256
 257
 258 */
 139  tbet_unregister=kobject_add_intbet_unregisters="sref">kobject_init(st=ks>(kobjectp>(EINVAL;
kobj) {
 145       <>(EINVAL;
 185 class="sref">fmt);
 113  k * be  pus=kobject_add_internal" pu(s="sr&s="sref">kobj(kobj(fmt);
 253}
 255
 256/**
 257
 258
 261 240
 241
 212
aI72match;t  obj: pLLs pound name of the kobject.
 263 "* ch/span>
 name of the kobject.
 264 */
kobject_init(struct kobjectkobject_init(st=ks>(kobjectp=ks>(kobj, const n="s * */
kobj) {
kobj, struct kobjectp>(fmt);
kobj, struct kobjectrks>(kobjecte=NUhref="+code=lise=NU" class="sref">retval;
 229
 180  spin_lock, kobj(kobj(fmt);
 271
 222  liss_poi_each_(       <>(kobj(kobj(kobj(kobj) {
 18272"="sref">kobjectel"  mus=kobject_add_internal" naname" > 272        >( 145       asscmp=kobject_add_inasscmps="s"ame!\n"el"  mus=kobject_add_internal" naname" > 272        >(kobj) {
 113  rks>(kobject(fmt);
fmt);
 14 name="L253"> 253}
 253}
 218
 180  spin_unlock, kobj(kobj(fmt);
 246      rks>(fmt);
 253}
fmt);
 139  tbet_releass=kobject_add_intbet_releasss="sref">kobject_init(struct kobjectpan>,  */
kobj) {
kobject_init(st=ks>(kobjectp=ks>(kvasprintconta8" r_ocokobject_add_inconta8" r_ocbj" "ame!\n", kobj, sp=ks>(kobj(fmt);
kobjref="+code=lispr_debuas="srt"sref">pr_debug("kobject: '&>"n the same direclass="sref">fmt);
 174ame!\n"el"  mus=kobject_add_internal" naname" > 272        (, fmt);
 248  t), n>(kvasprintp=ks>(fmt);
 253}
 190
kobj, struct  139  tbet_ /a> *kobj) {
kobj(kobj(
kobjkobject
fmt);
 255
 256
 257/**
 258/**
 261/**
 240/**
 261
 212
 263 *creizes a lbet ass="sure dy="Licer y. aT="coass="sure can name of the kobject.
 234
 265 266
 257 258/**
 261 tdi name of the kobject.
 240 */
kobj, st=ks>(kobjectp=ksacreize=kobject_add_int=ksacreizeass="ass="sref">kobj, const n="s * */
 18888888888ame="L rss="sass="sref">kobj, slbet_="sref op==kobject_add_intbet_u"sref op=" clss="sref">kobject="sref op==kobject_add_inu"sref op=" clc="comment"> */
 27 name="L8ame="Llass="sref">kobj, struct kobjecte(_pan>,  */
kobj) {
kobject_init(st=ks>(kobjectp=ks>(fmt);
 156stati5fmt);
 253}
 248  t=ks>(kvasprintezer oc>(kobject<=ks>(kobjf( 253}
 145       <=ks>( 253}
 185 "> 246      e=NUhref="+code=lise=NU" class="sref">retval;
 152  5kvasprinte/a>= kobj(kobj, retval;
 152  5kobj) {
 27248"> 248  t), n>(kvasprintp=ks>(fmt);
 246      e=NUhref="+code=lise=NU" class="sref">retval;
 253}
kobj(kobjkvasprint="sref op==kobject_add_inu"sref op=" class="sref">retval;
 147   bet>(kobj, kobj(kvasprinte(_pan>, retval;
 218
 256 */
 240  of tbet_ /a>  and belongain name of the kobject.
 241
 212
 263 */
 147   bet>(kobj, kobj *kobj *retval;
 147   bet>(kobj, kobj(kvasprinte=NUhref="+code=lise=NU" class="sref">retval;
fmt);
 246      e=ks>(fmt);
 253}
 229
 240
 261 212
 263/**
 234/**
 265
 256
 257 *creizes a lbet ass="sure dy="Licer y and registerse a name of the kobject.
 258 261
 240
 261
 212 tdi name of the kobject.
 263 */
kobj, st=ks>(kobjectp=ksacreize_andd hr=kobject_add_int=ksacreize_andd hrass="ass="sref">kobj, const n="s * */
kobj, slbet_="sref op==kobject_add_intbet_u"sref op=" clss="sref">kobject="sref op==kobject_add_inu"sref op=" clc="comment"> */
 1444444444444444444ass="sref">kobj, struct kobjecte(_pan>,  */
kobj) {
kobj, st=ks>(kobjectp=ks>(fmt);
 156statierror=kobject_add_inerror" clclass="sref">fmt);
 190
 152   =ks>(kvasprinte=ksacreize=kobject_add_int=ksacreizeass="obj, const n="s *kvasprint="sref op==kobject_add_inu"sref op=" clcname!\n"(_pan>, fmt);
 145       <=ks>( 253}
 275 "> 246      e=NUhref="+code=lise=NU" class="sref">retval;
 147  error=kobject_add_inerror" cl la="sref">kobjectkvasprintp=ks>(fmt);
 152  error=kobject_add_inerror" clalass="sref">kobj) {
 14 145       t), n>(kvasprintp=ks>(fmt);
 175 "> 246      e=NUhref="+code=lise=NU" class="sref">retval;
 253}
 246      e=ks>(fmt);
 253}
 246      EXPORT_SYMBOL_GP-fmt);
fmt);
ENOMEM;
 113  DEFINE_SPINLOCK=kobject_add_inDEFINE_SPINLOCKs="srt_set_name_vargs if_nspe" c_lock>(fmt);
kobj, sl if_nspe" c_operat"> s>( s" clss="sref">kobjectp if_nspop=_tblkobjectKOBJ_NS_TYPESfmt);
fmt);
 156statit if_nspe" c_register=kobject_add_int if_nspe" c_registerass="ass="sass="sref">kobj, sl if_nspe" c_operat"> s>( s" clss="sref">kobjectop==kobject_add_inop=" cl name="L253"> 253}
kobj) {
kobj, sl if_nspe" c>(kobj, se" c>(kobjectop==kobject_add_inop=" clclass="sref">kobj(fmt);
 156statierror=kobject_add_inerror" clclass="sref">fmt);
 271
 222  spin_lock, kobj(fmt);
ENOMEM;
 147  error=kobject_add_inerror" cl la              retINVA-fmt);
 152  e" c>(kobjectKOBJ_NS_TYPES 253}
 14gotoa="sref">kobjectous=kobject_add_inout" clclass="sref">fmt);
 253}
 248  error=kobject_add_inerror" cl la              retINVA-fmt);
kobjecte" c>(kobjectKOBJ_NS_TYPE_NONE 253}
 18gotoa="sref">kobjectous=kobject_add_inout" clclass="sref">fmt);
 271
 222  error=kobject_add_inerror" cl la              retBUSYfmt);
kobject_nspop=_tblkobjecte" c>( 253}
kobjectous=kobject_add_inout" clclass="sref">fmt);
 255
kobjfmt);
 147   /a>_nspop=_tblkobjecte" c>(kobjectop==kobject_add_inop=" clclass="sref">fmt);
 218
kobjectous=kobject_add_inout" cl: name="L218"> 218
 180  spin_unlock, kobj(fmt);
 246      error=kobject_add_inerror" clclass="sref">fmt);
 253}
ENOMEM;
 156statit if_nspe" c_registerer=kobject_add_int if_nspe" c_registerers="srenumref">kobj, sl if_nspe" c>(kobj, se" c>( 253}
kobj) {
 156stati5fmt);
 253}
 248  spin_lock, kobj(fmt);
 152  e" c>(kobjectKOBJ_NS_TYPE_NONEkobjecte" c>(kobjectKOBJ_NS_TYPES 253}
 18"> 156stati5 147   /a>_nspop=_tblkobjecte" c>( 234
 180  spin_unlock, kobj();

 18"> 1_nspe" c_lock>((_pan>bj"  ="comment"8 */);
8obj);
kobj, sl if_nspe" c_operat"> s>( ss="sass="sref">kobjchilda147"> 0"> 1236"8class83line" name="L146"> 1444444444444444444ass="sref">kobj, struct t_add_inu"sref op=" cnspe" cine" ef">kobj, se" c href="+c8de=5kobj, sl if_nspe" c_operat"> s>(kobj(kvasprinte=NUode=GFP_K8RNEL" class= cname="L2538> 25389a>}
, ,  147obj,  147, kobj, se" 9href="+co9e=lise=NU" class="sref">9etval9/a>;
kokobj,  147obj,  147, , (9etval90>);
9obj
(kobjecto9(9etval9a>);
 25390>);
<"lib/8object.c#L255" id="L255"8class855ine"asizic rss="sass="sref">kobj, sl if_nspe" c_operat"> s>( ss="sass="sref">kobj147"> 0"> 1236"8class83line" name="L146"> 1444444444444444444ass="sref">kobj, sbject_add_inu"sref ss="sref">kobjecte(_pan>, 9etval90an>
(_pan>bj" ass="sref">9etval90/a>
 ss="sass="sref">kobjchilda147"> 0"> 1ef">kobj, sbject_add_inu"sref ss="sref name="L147"> 147, ( 2190>);
 259);

<"lib/rat"> s>(kobj, sl if_nspe" c>(kobj, se" 9ishtd be;9   @fme name of the kobj9ct.

 s>(kobj(kvasprinte=N9ef="+code9bet_ /a> " class="sref">9etval91>);
9etval91/a>
 248  spin_lock, kobj( 152  e" c>(kobjectKOBJ_NS_TYPE_NONEkobjecte" c>(kob_NS_TYPE_NOnspe" c_lock>( 147   /a>_nspop=_tblkobj, se" 9i9="+code98class81line" name="L2539> 2539a>);
ko177" id="L177"8class87line" name="L147"> 147   /a>_nspop=_tbl 147( 2292/a>
 180  spin_unlock, kobj( 2409/a>);
);
(}

<"lib/8"lib/rat"> s>(kobj, sl if_nspe" c>( s>( 145    9 "colbet,9145anye name of the kobj9ct.
 259);
 s>(kobj(kvasprinte=N9 and regi9terse a name of the kobj9ct.);

 248  spin_lock, kobj( 152  e" c>(kobjectKOBJ_NS_TYPE_NONEkobjecte" c>(kob_NS_TYPE_NOnspe" c_lock>( 2409   @fme name of the kobj9ct.;
 147   /a>_nspop=_tblkobj, se" 9L261"> 269;
ko177" id="L177"8class87line" name="L147"> 147   /a>_nspop=_tbl 147 1ef">kobj, ss180"8class88line"31ine"Onspe" c_lock>( 180  spin_unlock, kobj( 2639/a>}

(
(_pan>bj"  ="comment"9 */);
9obj) {
<"lib/8"lib/rat"> s>(kobj, sl if_nspe" c>(kobj, se" 9>( s>(kobj(kvasprinte=N9" id="L249"8class84line" name="L199"> 1994>);
(_pan>bj"  class="sref9>fmt<94/a>
 222  spin_lock, kobj( 152  e" c>(kobjectKOBJ_NS_TYPE_NONEkobjecte" c>(kob_NS_TYPE_NOnspe" c_lock>( 2639e=lise=NU" class="sref">9etval94a>}
 147   /a>_nspop=_tblkobj, se" 9(ko177" id="L177"8class87line" name="L147"> 147   /a>_nspop=_tbl 147(9obj
 180  spin_unlock, kobj(9etval94/a>
( 25394>);
kobj, sl if_nspe" c>( s>(kobj, se" 9=ksacreiz9_andd hrass= class="sref9>fmt<9a>);
 222  spin_lock, kobj(9NOMEM9>) {
 152  e" c>(kobjectKOBJ_NS_TYPE_NONEkobjecte" c>(kob_NS_TYPE_NOnspe" c_lock>(fmt<9a>);
ko177" id="L177"8class87line" name="L147"> 147   /a>_nspop=_tbl 147   /a>_nspop=_tbl 147kobj, se" 9=ject_add9NS_TYPES" cl]class="sref9>fmt<9a>);
 147   /a>_nspop=_tbl 147(fmt<95>);
 180  spin_unlock, kobj(9obj}
 " clclass="sref9>fmt<9a>);
<>  spin_unlock,ne"> 246 n_unlocks="sr&ane"> 246 eratkvasprinte=ksacrbject.c_gL249"8class84line"ject.c_gL2ae if_nspe" c_lock>( 246 eratkvasprinte=ksacrbject.c_pect.c#L179" id="Lbject.c_pecae if_nspe" c_lock>( 279
 246 eratkvasprinte=ksacrbject.c_de8class87line" name="t.c_de8ae if_nspe" c_lock>(fmt<9a>);
9NOMEM9/a>;
 246 eratkvasprinte=ksacrb  error=kobject_add_inerror" cl la="sref">kof_nspe" c_lock>( 246 eratkvasprinte=ksacrb  er="L229"8clect_add_inerror" cl ="L229"8cl">kof_nspe" c_lock>(
210"original LXR softwne" by id="spe" c_lohttp://sourceforge.net/prohrefs/lxle>LXR objeunitynspe_o58lxl@cl ux.nonspe.
lxl.cl ux.no kindly ho"8cdcby spe" c_lohttp://www.redpill-cl pro.no">Redpill Ll pro ASnspe_oproviderL265Ll ux""libultass882li if_nspe" service since 1995.