1. 08 3月, 2010 2 次提交
  2. 24 12月, 2009 1 次提交
  3. 20 10月, 2008 1 次提交
    • P
      x86: sysfs: kill owner field from attribute · 01e8ef11
      Parag Warudkar 提交于
      Tejun's commit 7b595756 made sysfs
      attribute->owner unnecessary.  But the field was left in the structure to
      ease the merge.  It's been over a year since that change and it is now
      time to start killing attribute->owner along with its users - one arch at
      a time!
      
      This patch is attempt #1 to get rid of attribute->owner only for
      CONFIG_X86_64 or CONFIG_X86_32 .  We will deal with other arches later on
      as and when possible - avr32 will be the next since that is something I
      can test.  Compile (make allyesconfig / make allmodconfig / custom config)
      and boot tested.
      
      akpm: the idea is that we put the declaration of sttribute.owner inside
      `#ifndef CONFIG_X86'.  But that proved to be too ambitious for now because
      new usages kept on turning up in subsystem trees.
      
      [akpm: remove the ifdef for now]
      Signed-off-by: NParag Warudkar <parag.lkml@gmail.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Roland Dreier <rolandd@cisco.com>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      01e8ef11
  4. 17 10月, 2008 5 次提交
    • E
      kobject: Cleanup kobject_rename and !CONFIG_SYSFS · 0b4a4fea
      Eric W. Biederman 提交于
      It finally dawned on me what the clean fix to sysfs_rename_dir
      calling kobject_set_name is.  Move the work into kobject_rename
      where it belongs.  The callers serialize us anyway so this is
      safe.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0b4a4fea
    • E
      kobject: Fix kobject_rename and !CONFIG_SYSFS · 030c1d2b
      Eric W. Biederman 提交于
      When looking at kobject_rename I found two bugs with
      that exist when sysfs support is disabled in the kernel.
      
      kobject_rename does not change the name on the kobject when
      sysfs support is not compiled in.
      
      kobject_rename without locking attempts to check the
      validity of a rename operation, which the kobject layer
      simply does not have the infrastructure to do.
      
      This patch documents the previously unstated requirement of
      kobject_rename that is the responsibility of the caller to
      provide mutual exclusion and to be certain that the new_name
      for the kobject is valid.
      
      This patch modifies sysfs_rename_dir in !CONFIG_SYSFS case
      to call kobject_set_name to actually change the kobject_name.
      
      This patch removes the bogus and misleading check in kobject_rename
      that attempts to see if a rename is valid.  The check is bogus
      because we do not have the proper locking.  The check is misleading
      because it looks like we can and do perform checking at the kobject
      level that we don't.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      030c1d2b
    • T
      sysfs: Make dir and name args to sysfs_notify() const · 8c0e3998
      Trent Piepho 提交于
      Because they can be, and because code like this produces a warning if
      they're not:
      
      struct device_attribute dev_attr;
      
      sysfs_notify(&kobj, NULL, dev_attr.attr.name);
      Signed-off-by: NTrent Piepho <tpiepho@freescale.com>
      CC: Neil Brown <neilb@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8c0e3998
    • N
      sysfs: Support sysfs_notify from atomic context with new sysfs_notify_dirent · f1282c84
      Neil Brown 提交于
      Support sysfs_notify from atomic context with new sysfs_notify_dirent
      
      sysfs_notify currently takes sysfs_mutex.
      This means that it cannot be called in atomic context.
      sysfs_mutex  is sometimes held over a malloc (sysfs_rename_dir)
      so it can block on low memory.
      
      In md I want to be able to notify on a sysfs attribute from
      atomic context, and I don't want to block on low memory because I
      could be in the writeout path for freeing memory.
      
      So:
       - export the "sysfs_dirent" structure along with sysfs_get, sysfs_put
         and sysfs_get_dirent so I can get the sysfs_dirent that I want to
         notify on and hold it in an md structure.
       - split sysfs_notify_dirent out of sysfs_notify so the sysfs_dirent
         can be notified on with no blocking (just a spinlock).
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f1282c84
    • A
      sysfs: crash debugging · ae87221d
      Andrew Morton 提交于
      Print the name of the last-accessed sysfs file when we oops, to help track
      down oopses which occur in sysfs store/read handlers.  Because these oopses
      tend to not leave any trace of the offending code in the stack traces.
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ae87221d
  5. 22 7月, 2008 1 次提交
  6. 05 5月, 2008 1 次提交
    • I
      sysfs: build fix · e73b65f1
      Ingo Molnar 提交于
      x86.git testing found the following build failure on v2.6.26-rc1:
      
        In file included from include/linux/kobject.h:22,
                         from include/linux/module.h:17,
                         from include/linux/crypto.h:22,
                         from arch/x86/kernel/asm-offsets_32.c:8,
                         from arch/x86/kernel/asm-offsets.c:3:
        include/linux/sysfs.h:201: error: redefinition of 'sysfs_update_group'
        include/linux/sysfs.h:195: error: previous definition of 'sysfs_update_group' was here
        make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
        make: *** [prepare0] Error 2
      
      with the following config:
      
          http://redhat.com/~mingo/misc/config-Sun_May__4_07_09_30_CEST_2008.bad
      
      the reason for the build failure is the duplicate definition of the
      sysfs_update_group() inline function in include/linux/sysfs.h.
      
      The duplication was a merge error: it was added via -mm by commit
      v2.6.25-7262-g2850699c, "sysfs: sysfs_update_group stub for
      CONFIG_SYSFS=n" a day before v2.6.26-rc1, but a day before that the same
      commit was already merged upstream via the sysfs tree, with commit
      v2.6.25-7211-g1cbfb7a5.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e73b65f1
  7. 01 5月, 2008 2 次提交
  8. 23 4月, 2008 1 次提交
  9. 20 4月, 2008 1 次提交
  10. 24 1月, 2008 1 次提交
  11. 13 10月, 2007 4 次提交
  12. 12 7月, 2007 7 次提交
    • Z
      sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes · 91a69029
      Zhang Rui 提交于
      Well, first of all, I don't want to change so many files either.
      
      What I do:
      Adding a new parameter "struct bin_attribute *" in the
      .read/.write methods for the sysfs binary attributes.
      
      In fact, only the four lines change in fs/sysfs/bin.c and
      include/linux/sysfs.h do the real work.
      But I have to update all the files that use binary attributes
      to make them compatible with the new .read and .write methods.
      I'm not sure if I missed any. :(
      
      Why I do this:
      For a sysfs attribute, we can get a pointer pointing to the
      struct attribute in the .show/.store method,
      while we can't do this for the binary attributes.
      I don't know why this is different, but this does make it not
      so handy to use the binary attributes as the regular ones.
      So I think this patch is reasonable. :)
      
      Who benefits from it:
      The patch that exposes ACPI tables in sysfs
      requires such an improvement.
      All the table binary attributes share the same .read method.
      Parameter "struct bin_attribute *" is used to get
      the table signature and instance number which are used to
      distinguish different ACPI table binary attributes.
      
      Without this parameter, we need to offer different .read methods
      for different ACPI table binary attributes.
      This is impossible as there are various ACPI tables on different
      platforms, and we don't know what they are until they are loaded.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      91a69029
    • T
      sysfs: make directory dentries and inodes reclaimable · 51225039
      Tejun Heo 提交于
      This patch makes dentries and inodes for sysfs directories
      reclaimable.
      
      * sysfs_notify() is modified to walk sysfs_dirent tree instead of
        dentry tree.
      
      * sysfs_update_file() and sysfs_chmod_file() use sysfs_get_dentry() to
        grab the victim dentry.
      
      * sysfs_rename_dir() and sysfs_move_dir() grab all dentries using
        sysfs_get_dentry() on startup.
      
      * Dentries for all shadowed directories are pinned in memory to serve
        as lookup start point.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      51225039
    • T
      sysfs: make kobj point to sysfs_dirent instead of dentry · 608e266a
      Tejun Heo 提交于
      As kobj sysfs dentries and inodes are gonna be made reclaimable,
      dentry can't be used as naming token for sysfs file/directory, replace
      kobj->dentry with kobj->sd.  The only external interface change is
      shadow directory handling.  All other changes are contained in kobj
      and sysfs.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      608e266a
    • T
      sysfs: implement SYSFS_FLAG_REMOVED flag · 380e6fbb
      Tejun Heo 提交于
      Implement SYSFS_FLAG_REMOVED flag which currently is used only to
      improve sanity check in sysfs_deactivate().  The flag will be used to
      make directory entries reclamiable.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      380e6fbb
    • T
      sysfs: rename sysfs_dirent->s_type to s_flags and make room for flags · b402d72c
      Tejun Heo 提交于
      Rename sysfs_dirent->s_type to s_flags, pack type into lower eight
      bits and reserve the rest for flags.  sysfs_type() can used to access
      the type.  All existing sd->s_type accesses are converted to use
      sysfs_type().  While at it, type test is changed to equality test
      instead of bit-and test where appropriate.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b402d72c
    • T
      sysfs: kill unnecessary attribute->owner · 7b595756
      Tejun Heo 提交于
      sysfs is now completely out of driver/module lifetime game.  After
      deletion, a sysfs node doesn't access anything outside sysfs proper,
      so there's no reason to hold onto the attribute owners.  Note that
      often the wrong modules were accounted for as owners leading to
      accessing removed modules.
      
      This patch kills now unnecessary attribute->owner.  Note that with
      this change, userland holding a sysfs node does not prevent the
      backing module from being unloaded.
      
      For more info regarding lifetime rule cleanup, please read the
      following message.
      
        http://article.gmane.org/gmane.linux.kernel/510293
      
      (tweaked by Greg to not delete the field just yet, to make it easier to
      merge things properly.)
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7b595756
    • T
      sysfs: add sysfs_dirent->s_name · 0c096b50
      Tejun Heo 提交于
      Add s_name to sysfs_dirent.  This is to further reduce dependency to
      the associated dentry.  Name is copied for directories and symlinks
      but not for attributes.
      
      Where possible, name dereferences are converted to use sd->s_name.
      sysfs_symlink->link_name and sysfs_get_name() are unused now and
      removed.
      
      This change allows symlink to be implemented using sysfs_dirent tree
      proper, which is the last remaining dentry-dependent sysfs walk.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0c096b50
  13. 28 4月, 2007 1 次提交
  14. 19 3月, 2007 1 次提交
  15. 16 3月, 2007 1 次提交
    • A
      [PATCH] sysfs and driver core: add callback helper, used by SCSI and S390 · d9a9cdfb
      Alan Stern 提交于
      This patch (as868) adds a helper routine for device drivers that need
      to set up a callback to perform some action in a different process's
      context.  This is intended for use by attribute methods that want to
      unregister themselves or their parent device.  Attribute method calls
      are mutually exclusive with unregistration, so such actions cannot be
      taken directly.
      
      Two attribute methods are converted to use the new helper routine: one
      for SCSI device deletion and one for System/390 ccwgroup devices.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Hugh Dickins <hugh@veritas.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Oliver Neukum <oneukum@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d9a9cdfb
  16. 02 3月, 2007 1 次提交
  17. 24 2月, 2007 2 次提交
  18. 08 2月, 2007 2 次提交
    • E
      sysfs: Shadow directory support · b592fcfe
      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/*. 
      
      What I want is a separate /sys/class/net directory in sysfs for each
      network namespace, and I want to name each of them /sys/class/net.
      
      I looked and the VFS actually allows that.  All that is needed is
      for /sys/class/net to implement a follow link method to redirect
      lookups to the real directory you want. 
      
      Implementing a follow link method that is sensitive to the current
      network namespace turns out to be 3 lines of code so it looks like a
      clean approach.  Modifying sysfs so it doesn't get in my was is a bit
      trickier. 
      
      I am calling the concept of multiple directories all at the same path
      in the filesystem shadow directories.  With the directory entry really
      at that location the shadow master. 
      
      The following patch modifies sysfs so it can handle a directory
      structure slightly different from the kobject tree so I can implement
      the shadow directories for handling /sys/class/net/.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Cc: Maneesh Soni <maneesh@in.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b592fcfe
    • F
      SYSFS: Fix missing include of list.h in sysfs.h · bf0acc33
      Frank Haverkamp 提交于
      Sysfs.h uses definitions (e.g. struct list_head s_sibling) from list.h
      but does not include it.
      Signed-off-by: NFrank Haverkamp <haver@vnet.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bf0acc33
  19. 02 12月, 2006 1 次提交
  20. 26 9月, 2006 3 次提交
  21. 15 4月, 2006 1 次提交
    • N
      [PATCH] sysfs: Allow sysfs attribute files to be pollable · 4508a7a7
      NeilBrown 提交于
      It works like this:
        Open the file
        Read all the contents.
        Call poll requesting POLLERR or POLLPRI (so select/exceptfds works)
        When poll returns,
           close the file and go to top of loop.
         or lseek to start of file and go back to the 'read'.
      
      Events are signaled by an object manager calling
         sysfs_notify(kobj, dir, attr);
      
      If the dir is non-NULL, it is used to find a subdirectory which
      contains the attribute (presumably created by sysfs_create_group).
      
      This has a cost of one int  per attribute, one wait_queuehead per kobject,
      one int per open file.
      
      The name "sysfs_notify" may be confused with the inotify
      functionality.  Maybe it would be nice to support inotify for sysfs
      attributes as well?
      
      This patch also uses sysfs_notify to allow /sys/block/md*/md/sync_action
      to be pollable
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4508a7a7