1. 22 5月, 2010 7 次提交
    • E
      sysfs: Implement sysfs tagged directory support. · 3ff195b0
      Eric W. Biederman 提交于
      The problem.  When implementing a network namespace I need to be able
      to have multiple network devices with the same name.  Currently this
      is a problem for /sys/class/net/*, /sys/devices/virtual/net/*, and
      potentially a few other directories of the form /sys/ ... /net/*.
      
      What this patch does is to add an additional tag field to the
      sysfs dirent structure.  For directories that should show different
      contents depending on the context such as /sys/class/net/, and
      /sys/devices/virtual/net/ this tag field is used to specify the
      context in which those directories should be visible.  Effectively
      this is the same as creating multiple distinct directories with
      the same name but internally to sysfs the result is nicer.
      
      I am calling the concept of a single directory that looks like multiple
      directories all at the same path in the filesystem tagged directories.
      
      For the networking namespace the set of directories whose contents I need
      to filter with tags can depend on the presence or absence of hotplug
      hardware or which modules are currently loaded.  Which means I need
      a simple race free way to setup those directories as tagged.
      
      To achieve a reace free design all tagged directories are created
      and managed by sysfs itself.
      
      Users of this interface:
      - define a type in the sysfs_tag_type enumeration.
      - call sysfs_register_ns_types with the type and it's operations
      - sysfs_exit_ns when an individual tag is no longer valid
      
      - Implement mount_ns() which returns the ns of the calling process
        so we can attach it to a sysfs superblock.
      - Implement ktype.namespace() which returns the ns of a syfs kobject.
      
      Everything else is left up to sysfs and the driver layer.
      
      For the network namespace mount_ns and namespace() are essentially
      one line functions, and look to remain that.
      
      Tags are currently represented a const void * pointers as that is
      both generic, prevides enough information for equality comparisons,
      and is trivial to create for current users, as it is just the
      existing namespace pointer.
      
      The work needed in sysfs is more extensive.  At each directory
      or symlink creating I need to check if the directory it is being
      created in is a tagged directory and if so generate the appropriate
      tag to place on the sysfs_dirent.  Likewise at each symlink or
      directory removal I need to check if the sysfs directory it is
      being removed from is a tagged directory and if so figure out
      which tag goes along with the name I am deleting.
      
      Currently only directories which hold kobjects, and
      symlinks are supported.  There is not enough information
      in the current file attribute interfaces to give us anything
      to discriminate on which makes it useless, and there are
      no potential users which makes it an uninteresting problem
      to solve.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NBenjamin Thery <benjamin.thery@bull.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3ff195b0
    • E
      kobj: Add basic infrastructure for dealing with namespaces. · bc451f20
      Eric W. Biederman 提交于
      Move complete knowledge of namespaces into the kobject layer
      so we can use that information when reporting kobjects to
      userspace.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bc451f20
    • P
      lockdep: Add novalidate class for dev->mutex conversion · 1704f47b
      Peter Zijlstra 提交于
      The conversion of device->sem to device->mutex resulted in lockdep
      warnings. Create a novalidate class for now until the driver folks
      come up with separate classes. That way we have at least the basic
      mutex debugging coverage.
      
      Add a checkpatch error so the usage is reserved for device->mutex.
      
      [ tglx: checkpatch and compile fix for LOCKDEP=n ]
      Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1704f47b
    • T
      drivers/base: Convert dev->sem to mutex · 3142788b
      Thomas Gleixner 提交于
      The semaphore is semantically a mutex. Convert it to a real mutex and
      fix up a few places where code was relying on semaphore.h to be included
      by device.h, as well as the users of the trylock function, as that value
      is now reversed.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3142788b
    • P
      devtmpfs: support !CONFIG_TMPFS · da5e4ef7
      Peter Korsgaard 提交于
      Make devtmpfs available on (embedded) configurations without SHMEM/TMPFS,
      using ramfs instead.
      
      Saves ~15KB.
      Signed-off-by: NPeter Korsgaard <jacmet@sunsite.dk>
      Acked-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      da5e4ef7
    • N
      kref: remove kref_set · db1afffa
      NeilBrown 提交于
      Of the three uses of kref_set in the kernel:
      
       One really should be kref_put as the code is letting go of a
          reference,
       Two really should be kref_init because the kref is being
          initialised.
      
      This suggests that making kref_set available encourages bad code.
      So fix the three uses and remove kref_set completely.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Acked-by: NMimi Zohar <zohar@us.ibm.com>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      db1afffa
    • D
      firmware_class: fix memory leak - free allocated pages · dd336c55
      David Woodhouse 提交于
      fix memory leak introduced by the patch 6e03a201:
      firmware: speed up request_firmware()
      
      1. vfree won't release pages there were allocated explicitly and mapped
      using vmap. The memory has to be vunmap-ed and the pages needs
      to be freed explicitly
      
      2. page array is moved into the 'struct
      firmware' so that we can free it from release_firmware()
      and not only in fw_dev_release()
      
      The fix doesn't break the firmware load speed.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Singed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dd336c55
  2. 21 5月, 2010 33 次提交