1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct class</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="devdrivers.html#idp1109043876" title="The Basic Device Driver-Model Structures"><link rel="prev" href="API-struct-subsys-interface.html" title="struct subsys_interface"><link rel="next" href="API-struct-device.html" title="struct device"></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">struct class</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-subsys-interface.html">Prev</a> </td><th width="60%" align="center">The Basic Device Driver-Model Structures </th><td width="20%" align="right"> <a accesskey="n" href="API-struct-device.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-class"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct class — 2 device classes 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct class { 5 const char * name; 6 struct module * owner; 7 struct class_attribute * class_attrs; 8 const struct attribute_group ** dev_groups; 9 struct kobject * dev_kobj; 10 int (* dev_uevent) (struct device *dev, struct kobj_uevent_env *env); 11 char *(* devnode) (struct device *dev, umode_t *mode); 12 void (* class_release) (struct class *class); 13 void (* dev_release) (struct device *dev); 14 int (* suspend) (struct device *dev, pm_message_t state); 15 int (* resume) (struct device *dev); 16 const struct kobj_ns_type_operations * ns_type; 17 const void *(* namespace) (struct device *dev); 18 const struct dev_pm_ops * pm; 19 struct subsys_private * p; 20}; </pre></div><div class="refsect1"><a name="idp1109104572"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">name</span></dt><dd><p> 21 Name of the class. 22 </p></dd><dt><span class="term">owner</span></dt><dd><p> 23 The module owner. 24 </p></dd><dt><span class="term">class_attrs</span></dt><dd><p> 25 Default attributes of this class. 26 </p></dd><dt><span class="term">dev_groups</span></dt><dd><p> 27 Default attributes of the devices that belong to the class. 28 </p></dd><dt><span class="term">dev_kobj</span></dt><dd><p> 29 The kobject that represents this class and links it into the hierarchy. 30 </p></dd><dt><span class="term">dev_uevent</span></dt><dd><p> 31 Called when a device is added, removed from this class, or a 32 few other things that generate uevents to add the environment 33 variables. 34 </p></dd><dt><span class="term">devnode</span></dt><dd><p> 35 Callback to provide the devtmpfs. 36 </p></dd><dt><span class="term">class_release</span></dt><dd><p> 37 Called to release this class. 38 </p></dd><dt><span class="term">dev_release</span></dt><dd><p> 39 Called to release the device. 40 </p></dd><dt><span class="term">suspend</span></dt><dd><p> 41 Used to put the device to sleep mode, usually to a low power 42 state. 43 </p></dd><dt><span class="term">resume</span></dt><dd><p> 44 Used to bring the device from the sleep mode. 45 </p></dd><dt><span class="term">ns_type</span></dt><dd><p> 46 Callbacks so sysfs can detemine namespaces. 47 </p></dd><dt><span class="term">namespace</span></dt><dd><p> 48 Namespace of the device belongs to this class. 49 </p></dd><dt><span class="term">pm</span></dt><dd><p> 50 The default device power management operations of this class. 51 </p></dd><dt><span class="term">p</span></dt><dd><p> 52 The private data of the driver core, no one other than the 53 driver core can touch this. 54 </p></dd></dl></div></div><div class="refsect1"><a name="idp1109116068"></a><h2>Description</h2><p> 55 A class is a higher-level view of a device that abstracts out low-level 56 implementation details. Drivers may see a SCSI disk or an ATA disk, but, 57 at the class level, they are all simply disks. Classes allow user space 58 to work with devices based on what they do, rather than how they are 59 connected or how they work. 60</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-subsys-interface.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="devdrivers.html#idp1109043876">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-struct-device.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct subsys_interface</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">struct device</span></td></tr></table></div></body></html> 61