13 Oct, 2007

4 commits

  • Sysfs has gone through considerable amount of reimplementation. Add
    copyrights. Any objections? :-)

    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs_update_file() depends on inode->i_mtime but sysfs iondes are now
    reclaimable making the reported modification time unreliable. There's
    only one user (pci hotplug) of this notification mechanism and it
    reportedly isn't utilized from userland.

    Kill sysfs_update_file().

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs is about to go through major overhaul making this a pretty good
    opportunity to clean up (out-of-tree changes and pending patches will
    need regeneration anyway). Clean up headers.

    * Kill space between * and symbolname.

    * Move SYSFS_* type constants and flags into fs/sysfs/sysfs.h.
    They're internal to sysfs.

    * Reformat function prototypes and add argument symbol names.

    * Make dummy function definition order match that of function
    prototypes.

    * Add some comments.

    * Reorganize fs/sysfs/sysfs.h according to which file the declared
    variable or feature lives in.

    This patch does not introduce any behavior change.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • While shadow directories appear to be a good idea, the current scheme
    of controlling their creation and destruction outside of sysfs appears
    to be a locking and maintenance nightmare in the face of sysfs
    directories dynamically coming and going. Which can now occur for
    directories containing network devices when CONFIG_SYSFS_DEPRECATED is
    not set.

    This patch removes everything from the initial shadow directory support
    that allowed the shadow directory creation to be controlled at a higher
    level. So except for a few bits of sysfs_rename_dir everything from
    commit b592fcfe7f06c15ec11774b5be7ce0de3aa86e73 is now gone.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

12 Jul, 2007

7 commits

  • 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: Zhang Rui
    Signed-off-by: Greg Kroah-Hartman

    Zhang Rui
     
  • 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: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    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: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    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: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    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: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    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: Tejun Heo
    Cc: Cornelia Huck
    Cc: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    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: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     

28 Apr, 2007

1 commit

  • This patch (as896b) fixes an oversight in the design of
    device_schedule_callback(). It is necessary to acquire a reference to the
    module owning the callback routine, to prevent the module from being
    unloaded before the callback can run.

    Signed-off-by: Alan Stern
    Cc: Satyam Sharma
    Cc: Neil Brown
    Cc: Cornelia Huck
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

19 Mar, 2007

1 commit


16 Mar, 2007

1 commit

  • 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: Alan Stern
    Cc: Hugh Dickins
    Cc: Cornelia Huck
    Cc: Oliver Neukum
    Signed-off-by: Linus Torvalds

    Alan Stern
     

02 Mar, 2007

1 commit


27 Feb, 2007

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6:
    Revert "Driver core: let request_module() send a /sys/modules/kmod/-uevent"
    Driver core: fix error by cleanup up symlinks properly
    make kernel/kmod.c:kmod_mk static
    power management: fix struct layout and docs
    power management: no valid states w/o pm_ops
    Driver core: more fallout from class_device changes for pcmcia
    sysfs: move struct sysfs_dirent to private header
    driver core: refcounting fix
    Driver core: remove class_device_rename

    Linus Torvalds
     

24 Feb, 2007

2 commits

  • This patch (as860) adds two new sysfs routines:
    sysfs_add_file_to_group() and sysfs_remove_file_from_group().
    A later patch adds code that uses the new routines.

    Signed-off-by: Alan Stern
    Cc: Maneesh Soni
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • struct sysfs_dirent is private to the fs/sysfs/ subtree. It is
    not even referenced as an opaque structure outside of that subtree.

    The following patch moves the declaration from include/linux/sysfs.h to
    fs/sysfs/sysfs.h, making it clearer that nothing else in the kernel
    dereferences it.

    I have been running this patch for years. Please integrate and forward
    upstream if there are no objections.

    From: "Adam J. Richter"
    Signed-off-by: Greg Kroah-Hartman

    Adam J. Richter
     

08 Feb, 2007

2 commits

  • 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: Eric W. Biederman
    Cc: Maneesh Soni
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • Sysfs.h uses definitions (e.g. struct list_head s_sibling) from list.h
    but does not include it.

    Signed-off-by: Frank Haverkamp
    Signed-off-by: Greg Kroah-Hartman

    Frank Haverkamp
     

02 Dec, 2006

1 commit

  • Provide a function device_move() to move a device to a new parent device. Add
    auxilliary functions kobject_move() and sysfs_move_dir().
    kobject_move() generates a new uevent of type KOBJ_MOVE, containing the
    previous path (DEVPATH_OLD) in addition to the usual values. For this, a new
    interface kobject_uevent_env() is created that allows to add further
    environmental data to the uevent at the kobject layer.

    Signed-off-by: Cornelia Huck
    Acked-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Cornelia Huck
     

26 Sep, 2006

3 commits

  • Don't be crufty. Mark it __must_check too.

    Cc: "Randy.Dunlap"
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Andrew Morton
     
  • We're getting a lot of crashes in the sysfs/kobject/device/bus/class code and
    they're very hard to diagnose.

    I'm suspecting that in some cases this is because drivers aren't checking
    return values and aren't handling errors correctly. So the code blithely
    blunders on and crashes later in very obscure ways.

    There's just no reason to ignore errors which can and do occur. So the patch
    sprinkles __must_check all over these APIs.

    Causes 1,513 new warnings. Heh.

    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Andrew Morton
     
  • Make sysfs_remove_bin_file() void. If it detects an error,
    printk the file name and call dump_stack().

    sysfs_hash_and_remove() now returns an error code indicating
    its success or failure so that sysfs_remove_bin_file() can
    know success/failure.

    Convert the only driver that checked the return value of
    sysfs_remove_bin_file().

    Signed-off-by: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman

    Randy.Dunlap
     

15 Apr, 2006

1 commit

  • 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: Neil Brown
    Signed-off-by: Greg Kroah-Hartman

    NeilBrown
     

21 Jun, 2005

3 commits


19 Apr, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds