Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189112
b: refs/heads/master
c: 25daeb5
h: refs/heads/master
v: v3
  • Loading branch information
Dean Nelson authored and Jesse Barnes committed Mar 19, 2010
1 parent bf07775 commit 371e3e9
Show file tree
Hide file tree
Showing 332 changed files with 1,758 additions and 2,927 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4d50423d773fb8d5b714430ba5358e8a1b87c14
refs/heads/master: 25daeb550b69e89aff59bc6a84218a12b5203531
2 changes: 1 addition & 1 deletion trunk/Documentation/ABI/testing/sysfs-bus-usb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Description:
match the driver to the device. For example:
# echo "046d c315" > /sys/bus/usb/drivers/foo/remove_id

What: /sys/bus/usb/device/.../avoid_reset_quirk
What: /sys/bus/usb/device/.../avoid_reset
Date: December 2009
Contact: Oliver Neukum <oliver@neukum.org>
Description:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion trunk/Documentation/cgroups/memory.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Note:
5.3 swappiness
Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only.

Following cgroups' swappiness can't be changed.
Following cgroups' swapiness can't be changed.
- root cgroup (uses /proc/sys/vm/swappiness).
- a cgroup which uses hierarchy and it has child cgroup.
- a cgroup which uses hierarchy and not the root of hierarchy.
Expand Down
234 changes: 0 additions & 234 deletions trunk/Documentation/circular-buffers.txt

This file was deleted.

6 changes: 1 addition & 5 deletions trunk/Documentation/filesystems/tmpfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ tmpfs has a mount option to set the NUMA memory allocation policy for
all files in that instance (if CONFIG_NUMA is enabled) - which can be
adjusted on the fly via 'mount -o remount ...'

mpol=default use the process allocation policy
(see set_mempolicy(2))
mpol=default prefers to allocate memory from the local node
mpol=prefer:Node prefers to allocate memory from the given Node
mpol=bind:NodeList allocates memory only from nodes in NodeList
mpol=interleave prefers to allocate from each node in turn
mpol=interleave:NodeList allocates from each node of NodeList in turn
mpol=local prefers to allocate memory from the local node

NodeList format is a comma-separated list of decimal numbers and ranges,
a range being two hyphen-separated decimal numbers, the smallest and
Expand Down Expand Up @@ -136,5 +134,3 @@ Author:
Christoph Rohland <cr@sap.com>, 1.12.01
Updated:
Hugh Dickins, 4 June 2007
Updated:
KOSAKI Motohiro, 16 Mar 2010
60 changes: 20 additions & 40 deletions trunk/Documentation/kobject.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,56 +59,37 @@ nice to have in other objects. The C language does not allow for the
direct expression of inheritance, so other techniques - such as structure
embedding - must be used.

(As an aside, for those familiar with the kernel linked list implementation,
this is analogous as to how "list_head" structs are rarely useful on
their own, but are invariably found embedded in the larger objects of
interest.)
So, for example, the UIO code has a structure that defines the memory
region associated with a uio device:

So, for example, the UIO code in drivers/uio/uio.c has a structure that
defines the memory region associated with a uio device:

struct uio_map {
struct uio_mem {
struct kobject kobj;
struct uio_mem *mem;
};
unsigned long addr;
unsigned long size;
int memtype;
void __iomem *internal_addr;
};

If you have a struct uio_map structure, finding its embedded kobject is
If you have a struct uio_mem structure, finding its embedded kobject is
just a matter of using the kobj member. Code that works with kobjects will
often have the opposite problem, however: given a struct kobject pointer,
what is the pointer to the containing structure? You must avoid tricks
(such as assuming that the kobject is at the beginning of the structure)
and, instead, use the container_of() macro, found in <linux/kernel.h>:

container_of(pointer, type, member)

where:

* "pointer" is the pointer to the embedded kobject,
* "type" is the type of the containing structure, and
* "member" is the name of the structure field to which "pointer" points.

The return value from container_of() is a pointer to the corresponding
container type. So, for example, a pointer "kp" to a struct kobject
embedded *within* a struct uio_map could be converted to a pointer to the
*containing* uio_map structure with:

struct uio_map *u_map = container_of(kp, struct uio_map, kobj);

For convenience, programmers often define a simple macro for "back-casting"
kobject pointers to the containing type. Exactly this happens in the
earlier drivers/uio/uio.c, as you can see here:

struct uio_map {
struct kobject kobj;
struct uio_mem *mem;
};
container_of(pointer, type, member)

#define to_map(map) container_of(map, struct uio_map, kobj)
where pointer is the pointer to the embedded kobject, type is the type of
the containing structure, and member is the name of the structure field to
which pointer points. The return value from container_of() is a pointer to
the given type. So, for example, a pointer "kp" to a struct kobject
embedded within a struct uio_mem could be converted to a pointer to the
containing uio_mem structure with:

where the macro argument "map" is a pointer to the struct kobject in
question. That macro is subsequently invoked with:
struct uio_mem *u_mem = container_of(kp, struct uio_mem, kobj);

struct uio_map *map = to_map(kobj);
Programmers often define a simple macro for "back-casting" kobject pointers
to the containing type.


Initialization of kobjects
Expand Down Expand Up @@ -406,5 +387,4 @@ called, and the objects in the former circle release each other.
Example code to copy from

For a more complete example of using ksets and kobjects properly, see the
example programs samples/kobject/{kobject-example.c,kset-example.c},
which will be built as loadable modules if you select CONFIG_SAMPLE_KOBJECT.
sample/kobject/kset-example.c code.
Loading

0 comments on commit 371e3e9

Please sign in to comment.