1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>kset_create_and_add</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch01s08.html" title="Kernel objects manipulation"><link rel="prev" href="API-kset-unregister.html" title="kset_unregister"><link rel="next" href="ch01s09.html" title="Kernel utility functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">kset_create_and_add</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-kset-unregister.html">Prev</a>&#160;</td><th width="60%" align="center">Kernel objects manipulation</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch01s09.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-kset-create-and-add"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>kset_create_and_add &#8212; 
2     create a struct kset dynamically and add it to sysfs
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">struct kset * <b class="fsfunc">kset_create_and_add </b>(</code></td><td>const char * <var class="pdparam">name</var>, </td></tr><tr><td>&#160;</td><td>const struct kset_uevent_ops * <var class="pdparam">uevent_ops</var>, </td></tr><tr><td>&#160;</td><td>struct kobject * <var class="pdparam">parent_kobj</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1108290748"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>name</code></em></span></dt><dd><p>
4     the name for the kset
5    </p></dd><dt><span class="term"><em class="parameter"><code>uevent_ops</code></em></span></dt><dd><p>
6     a struct kset_uevent_ops for the kset
7    </p></dd><dt><span class="term"><em class="parameter"><code>parent_kobj</code></em></span></dt><dd><p>
8     the parent kobject of this kset, if any.
9    </p></dd></dl></div></div><div class="refsect1"><a name="idp1108294444"></a><h2>Description</h2><p>
10   This function creates a kset structure dynamically and registers it
11   with sysfs.  When you are finished with this structure, call
12   <code class="function">kset_unregister</code> and the structure will be dynamically freed when it
13   is no longer being used.
14   </p><p>
15
16   If the kset was not able to be created, NULL will be returned.
17</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-kset-unregister.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch01s08.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch01s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">kset_unregister</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Kernel utility functions</td></tr></table></div></body></html>
18