1. 03 Mar, 2015 4 commits
    • Takashi Iwai's avatar
      ALSA: hda - Allocate hda_pcm objects dynamically · bbbc7e85
      Takashi Iwai authored
      So far, the hda_codec object kept the hda_pcm list in an array, and
      the codec driver was expected to assign the array.  However, this
      makes the object life cycle management harder, because the assigned
      array is freed at the codec driver detach while it might be still
      accessed by the opened streams.
      
      In this patch, we allocate each hda_pcm object dynamically and manage
      it as a linked list.  Each object has a kref refcount, and both the
      codec driver binder and the PCM open/close touches it, so that the
      object won't be freed while in use.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      bbbc7e85
    • Takashi Iwai's avatar
      ALSA: hda - Remove superfluous memory allocation error messages · f4de8fe6
      Takashi Iwai authored
      The memory allocators should have already given the kernel warning
      messages, thus we don't have to annoy again.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f4de8fe6
    • Takashi Iwai's avatar
      ALSA: hda - Add card field to hda_codec struct · 6efdd851
      Takashi Iwai authored
      Allow the codec object to have an individual card pointer.  Not only
      this simplifies the redirections in many places, also this will allow
      us to make each codec assigned to a different card object.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6efdd851
    • Takashi Iwai's avatar
      ALSA: hda - Split snd_hda_build_pcms() · 1a4ba30c
      Takashi Iwai authored
      snd_hda_build_pcms() does actually three things: let the codec driver
      build up hda_pcm list, set the PCM default values, and call the
      attach_pcm bus ops for each hda_pcm instance.  The former two are
      basically independent from the bus implementation, so it'd make the
      code a bit more readable.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1a4ba30c
  2. 26 Feb, 2015 6 commits
    • Takashi Iwai's avatar
      ALSA: hda - Clear pcm pointer assigned to hda_pcm at device removal · 820cc6cf
      Takashi Iwai authored
      We leave the pcm field of struct hda_pcm at removal of each device, so
      far.  This hasn't been a problem since unbinding the codec driver
      isn't supposed to happen and another route via snd_hda_codec_reset()
      clears all the once.  However, for a proper unbind implementation, we
      need to care about it.
      
      This patch does the thing above properly:
      
      - Include struct hda_pcm pointer instead of struct hda_pcm_stream
        pointers in struct azx_dev.  This allows us to point the hda_pcm
        object at dev_free callback.
      
      - Introduce to_hda_pcm_stream() macro for better readability.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      820cc6cf
    • Takashi Iwai's avatar
      ALSA: hda - Remove channel mode helper functions · 7e40b80d
      Takashi Iwai authored
      They are no longer used, let's kill them.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7e40b80d
    • Takashi Iwai's avatar
      ALSA: hda - Set parent of input beep devices · 777ae194
      Takashi Iwai authored
      Set the card device as the parent like other sound devices instead of
      leaving it empty.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      777ae194
    • Takashi Iwai's avatar
      ALSA: hda - Power down codec automatically at registration · 709949fb
      Takashi Iwai authored
      So far, we let the controller driver power down the all codecs at the
      end of probe.  But this can be done better in the codec's dev_register
      callback.  This results in the reduction of duplicated codes in each
      control driver.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      709949fb
    • Takashi Iwai's avatar
      ALSA: hda - Replace bus pm_notify with the standard runtime PM framework · 55ed9cd1
      Takashi Iwai authored
      Now the final bit of runtime PM cleanup: instead of manual
      notification of the power up/down of the codec via hda_bus pm_notify
      ops, use the standard runtime PM feature.
      
      The child codec device will kick off the runtime PM of the parent
      (PCI) device upon suspend/resume automatically.  For managing whether
      the link can be really turned off, we use the bit flags
      bus->codec_powered instead of the earlier bus->power_keep_link_on.
      flag.  Each codec driver is responsible to set/clear the bit flag, and
      the controller device can be turned off only when all these bits are
      cleared.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      55ed9cd1
    • Takashi Iwai's avatar
      ALSA: hda - Drop power_save value indirection in hda_bus · bb573928
      Takashi Iwai authored
      We used to pass the power_save option value to hda_bus via a given
      pointer.  This was needed to refer to the value from the HD-audio core
      side.  However, after the transition to the runtime PM, this is no
      longer needed.
      
      This patch drops the power_save value indirection in hda_bus above,
      and let the controller driver reprograms the autosuspend value
      explicitly by a new helper, snd_hda_set_power_save().  Without this
      call, the HD-audio core doesn't set up the autosuspend and flip the
      runtime PM.  (User may still be able to set up via sysfs, though.)
      
      Along with this change, the pointer argument of azx_bus_create() is
      dropped as well.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      bb573928
  3. 23 Feb, 2015 19 commits
    • Takashi Iwai's avatar
      ALSA: hda - Use standard runtime PM for codec power-save control · cc72da7d
      Takashi Iwai authored
      Like the previous transition of suspend/resume, now move the
      power-save code to the standard runtime PM.  As usual for runtime PM,
      it's a bit tricky, but this simplified codes a lot in the end.
      
      For keeping the usage compatibility, power_save module option still
      controls the whole power-saving behavior on all codecs.  The value is
      translated to pm_runtime_*_autosuspend() and pm_runtime_allow() /
      pm_runtime_forbid() calls.
      
      snd_hda_power_up() and snd_hda_power_down() are translated to
      pm_runtime_get_sync() and pm_runtime_put_autosuspend(), respectively.
      Since we can do call pm_runtime_get_sync() more reliably, the sync
      version is used always and snd_hda_power_up_d3wait() is dropped.
      Another slight difference is that snd_hda_power_up()/down() don't call
      runtime_pm code during the suspend/resume transition phase.  Calling
      them there isn't safe unlike our own code, resulted in unexpected
      behavior (endless wakeups).
      
      The hda_power_count tracepoint was removed, as it doesn't match well
      with the new code.
      
      Last but not least, we need to set ignore_children flag in the parent
      dev.power field so that the runtime PM of the controller chip won't
      get confused.  The notification is still done in the bus pm_notify
      callback.  We'll get rid of this hack in the later patch.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cc72da7d
    • Takashi Iwai's avatar
      ALSA: hda - Move codec suspend/resume to codec driver · 59ed1ead
      Takashi Iwai authored
      This patch moves the suspend/resume mechanisms down to each codec
      driver level, as we have a proper codec driver bound on the bus now.
      Then we get the asynchronous PM gratis without fiddling much in the
      driver level.
      
      As a soft-landing transition, implement the common suspend/resume pm
      ops for hda_codec_driver and keep the each codec driver intact.  Only
      the callers of suspend/resume in the controller side (azx_suspend()
      and azx_resume()) are removed.
      
      Another involved place is azx_bus_reset() calling the temporary
      suspend and resume as a hackish method of bus reset.  The HD-audio
      core provide a helper function snd_hda_bus_reset() instead.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      59ed1ead
    • Takashi Iwai's avatar
      ALSA: hda - Bind codecs via standard bus · d8a766a1
      Takashi Iwai authored
      Now we create the standard HD-audio bus (/sys/bus/hdaudio), and bind
      the codec driver with the codec device over there.  This is the first
      step of the whole transition so that the changes to each codec driver
      are kept as minimal as possible.
      
      Each codec driver needs to register hda_codec_driver struct containing
      the currently existing preset via the new helper macro
      module_hda_codec_driver().  The old hda_codec_preset_list is replaced
      with this infrastructure.  The generic parsers (for HDMI and other)
      are also included in the preset with the special IDs to bind
      uniquely.
      
      In HD-audio core side, the device binding code is split to
      hda_bind.c.  It provides the snd_hda_bus_type implementation to match
      the codec driver with the given codec vendor ID.  It also manages the
      module auto-loading by itself like before: when the matching isn't
      found, it tries to probe the corresponding codec modules, and finally
      falls back to the generic drivers.  (The special ID mentioned above is
      set at this stage.)
      
      The only visible change to outside is that the hdaudio sysfs entry now
      appears in /sys/bus/devices, not as a sound class device.
      
      More works to move the suspend/resume and remove ops will be
      (hopefully) done in later patches.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d8a766a1
    • Takashi Iwai's avatar
      ALSA: hda - Decouple PCM and hwdep devices from codec object · 327ef4f0
      Takashi Iwai authored
      This is a preliminary patch for the hda_bus implementation, removing
      the parent device setup to codec device.  Since the bus and the class
      devices can't be crossed over, leave the sound devices to the default
      parent device as is.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      327ef4f0
    • Takashi Iwai's avatar
      72f770c6
    • Takashi Iwai's avatar
      0eee62e0
    • Takashi Iwai's avatar
      8d085d3c
    • Takashi Iwai's avatar
      Merge branch 'topic/uapi-fix' into for-next · 88cacc57
      Takashi Iwai authored
      88cacc57
    • Takashi Iwai's avatar
      6176fadc
    • Takashi Iwai's avatar
      Merge branch 'topic/cleanup' into for-next · 66c21c5a
      Takashi Iwai authored
      66c21c5a
    • Takashi Sakamoto's avatar
      ALSA: fireworks/bebob/dice/oxfw: make it possible to shutdown safely · dec84316
      Takashi Sakamoto authored
      A part of these drivers, especially BeBoB driver, are programmed to wait
      some events. Thus the drivers should not destroy any data in .remove()
      context.
      
      This commit moves some destructors from 'struct fw_driver.remove()' to
      'struct snd_card.private_free()' to shutdown safely.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # 3.19+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      dec84316
    • Takashi Sakamoto's avatar
      ALSA: fireworks/bebob/dice/oxfw: allow stream destructor after releasing runtime · d23c2cc4
      Takashi Sakamoto authored
      Currently stream destructor in each driver has a problem to be called in
      a context in which sound card object is released, because the destructors
      call amdtp_stream_pcm_abort() and touch PCM runtime data.
      
      The PCM runtime data is destroyed in application's context with
      snd_pcm_close(), on the other hand PCM substream data is destroyed after
      sound card object is released, in most case after all of ALSA character
      devices are released. When PCM runtime is destroyed and PCM substream is
      remained, amdtp_stream_pcm_abort() touches PCM runtime data and causes
      Null-pointer-dereference.
      
      This commit changes stream destructors and allows each driver to call
      it after releasing runtime.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # 3.19+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d23c2cc4
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: remove reference counting · c6f224dc
      Takashi Sakamoto authored
      AMDTP helper functions increment/decrement reference counter for an
      instance of FireWire unit, while it's complicated for each driver to
      process error state.
      
      In previous commit, each driver has the role of reference counting. This
      commit removes this role from the helper function.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # 3.19+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c6f224dc
    • Takashi Sakamoto's avatar
      ALSA: fireworks/bebob/dice/oxfw: add reference-counting for FireWire unit · 12ed7192
      Takashi Sakamoto authored
      Fireworks and Dice drivers try to touch instances of FireWire unit after
      sound card object is released, while references to the unit is decremented
      in .remove(). When unplugging during streaming, sound card object is
      released after .remove(), thus Fireworks and Dice drivers causes GPF or
      Null-pointer-dereferencing to application processes because an instance of
      FireWire unit was already released.
      
      This commit adds reference-counting for FireWire unit in drivers to allow
      them to touch an instance of FireWire unit after .remove(). In most case,
      any operations after .remove() may be failed safely.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # 3.19+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      12ed7192
    • Takashi Iwai's avatar
      ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec · 6426460e
      Takashi Iwai authored
      BIOS doesn't seem to set up pins for 5.1 and the SPDIF out, so we need
      to give explicitly here.
      Reported-and-tested-by: default avatarMisan Thropos <misanthropos@gmx.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6426460e
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: fix an unexpected byte sequence for micro sign · ca5b5050
      Takashi Sakamoto authored
      The sign for microsecond (U+0085, MICRO SIGN) was encoded to '0x c2 b5'
      by UTF-8 character encoding scheme. But the byte sequence was converted
      to '0x c3 82 c2 b5' in a previous commit. As a result, the byte
      sequence cannot represent microsecond sign in UTF-8 or ASCII. This
      may confuse developers.
      
      This commit replaces the sign to string expression with 'microseconds'
      to purge superfluous troubles.
      
      Fixes: 5c697e5b("ALSA: firewire-lib: remove rx_blocks_for_midi quirk")
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ca5b5050
    • Linus Torvalds's avatar
      Linux 4.0-rc1 · c517d838
      Linus Torvalds authored
      .. after extensive statistical analysis of my G+ polling, I've come to
      the inescapable conclusion that internet polls are bad.
      
      Big surprise.
      
      But "Hurr durr I'ma sheep" trounced "I like online polls" by a 62-to-38%
      margin, in a poll that people weren't even supposed to participate in.
      Who can argue with solid numbers like that? 5,796 votes from people who
      can't even follow the most basic directions?
      
      In contrast, "v4.0" beat out "v3.20" by a slimmer margin of 56-to-44%,
      but with a total of 29,110 votes right now.
      
      Now, arguably, that vote spread is only about 3,200 votes, which is less
      than the almost six thousand votes that the "please ignore" poll got, so
      it could be considered noise.
      
      But hey, I asked, so I'll honor the votes.
      c517d838
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · feaf2229
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Ext4 bug fixes.
      
        We also reserved code points for encryption and read-only images (for
        which the implementation is mostly just the reserved code point for a
        read-only feature :-)"
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: fix indirect punch hole corruption
        ext4: ignore journal checksum on remount; don't fail
        ext4: remove duplicate remount check for JOURNAL_CHECKSUM change
        ext4: fix mmap data corruption in nodelalloc mode when blocksize < pagesize
        ext4: support read-only images
        ext4: change to use setup_timer() instead of init_timer()
        ext4: reserve codepoints used by the ext4 encryption feature
        jbd2: complain about descriptor block checksum errors
      feaf2229
    • Linus Torvalds's avatar
      Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · be5e6616
      Linus Torvalds authored
      Pull more vfs updates from Al Viro:
       "Assorted stuff from this cycle.  The big ones here are multilayer
        overlayfs from Miklos and beginning of sorting ->d_inode accesses out
        from David"
      
      * 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (51 commits)
        autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
        procfs: fix race between symlink removals and traversals
        debugfs: leave freeing a symlink body until inode eviction
        Documentation/filesystems/Locking: ->get_sb() is long gone
        trylock_super(): replacement for grab_super_passive()
        fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
        Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
        VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
        SELinux: Use d_is_positive() rather than testing dentry->d_inode
        Smack: Use d_is_positive() rather than testing dentry->d_inode
        TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
        Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
        Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
        VFS: Split DCACHE_FILE_TYPE into regular and special types
        VFS: Add a fallthrough flag for marking virtual dentries
        VFS: Add a whiteout dentry type
        VFS: Introduce inode-getting helpers for layered/unioned fs environments
        Infiniband: Fix potential NULL d_inode dereference
        posix_acl: fix reference leaks in posix_acl_create
        autofs4: Wrong format for printing dentry
        ...
      be5e6616
  4. 22 Feb, 2015 11 commits
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm · 90c453ca
      Linus Torvalds authored
      Pull ARM fix from Russell King:
       "Just one fix this time around.  __iommu_alloc_buffer() can cause a
        BUG() if dma_alloc_coherent() is called with either __GFP_DMA32 or
        __GFP_HIGHMEM set.  The patch from Alexandre addresses this"
      
      * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
        ARM: 8305/1: DMA: Fix kzalloc flags in __iommu_alloc_buffer()
      90c453ca
    • Al Viro's avatar
      autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation · 0a280962
      Al Viro authored
      X-Coverup: just ask spender
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      0a280962
    • Al Viro's avatar
      procfs: fix race between symlink removals and traversals · 7e0e953b
      Al Viro authored
      use_pde()/unuse_pde() in ->follow_link()/->put_link() resp.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      7e0e953b
    • Al Viro's avatar
      debugfs: leave freeing a symlink body until inode eviction · 0db59e59
      Al Viro authored
      As it is, we have debugfs_remove() racing with symlink traversals.
      Supply ->evict_inode() and do freeing there - inode will remain
      pinned until we are done with the symlink body.
      
      And rip the idiocy with checking if dentry is positive right after
      we'd verified debugfs_positive(), which is a stronger check...
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      0db59e59
    • Al Viro's avatar
      dca11178
    • Konstantin Khlebnikov's avatar
      trylock_super(): replacement for grab_super_passive() · eb6ef3df
      Konstantin Khlebnikov authored
      I've noticed significant locking contention in memory reclaimer around
      sb_lock inside grab_super_passive(). Grab_super_passive() is called from
      two places: in icache/dcache shrinkers (function super_cache_scan) and
      from writeback (function __writeback_inodes_wb). Both are required for
      progress in memory allocator.
      
      Grab_super_passive() acquires sb_lock to increment sb->s_count and check
      sb->s_instances. It seems sb->s_umount locked for read is enough here:
      super-block deactivation always runs under sb->s_umount locked for write.
      Protecting super-block itself isn't a problem: in super_cache_scan() sb
      is protected by shrinker_rwsem: it cannot be freed if its slab shrinkers
      are still active. Inside writeback super-block comes from inode from bdi
      writeback list under wb->list_lock.
      
      This patch removes locking sb_lock and checks s_instances under s_umount:
      generic_shutdown_super() unlinks it under sb->s_umount locked for write.
      New variant is called trylock_super() and since it only locks semaphore,
      callers must call up_read(&sb->s_umount) instead of drop_super(sb) when
      they're done.
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      eb6ef3df
    • David Howells's avatar
      fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions · 54f2a2f4
      David Howells authored
      Fanotify probably doesn't want to watch autodirs so make it use d_can_lookup()
      rather than d_is_dir() when checking a dir watch and give an error on fake
      directories.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      54f2a2f4
    • David Howells's avatar
      Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions · ce40fa78
      David Howells authored
      Fix up the following scripted S_ISDIR/S_ISREG/S_ISLNK conversions (or lack
      thereof) in cachefiles:
      
       (1) Cachefiles mostly wants to use d_can_lookup() rather than d_is_dir() as
           it doesn't want to deal with automounts in its cache.
      
       (2) Coccinelle didn't find S_IS* expressions in ASSERT() statements in
           cachefiles.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      ce40fa78
    • David Howells's avatar
      VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) · e36cb0b8
      David Howells authored
      Convert the following where appropriate:
      
       (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
      
       (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
      
       (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
           complicated than it appears as some calls should be converted to
           d_can_lookup() instead.  The difference is whether the directory in
           question is a real dir with a ->lookup op or whether it's a fake dir with
           a ->d_automount op.
      
      In some circumstances, we can subsume checks for dentry->d_inode not being
      NULL into this, provided we the code isn't in a filesystem that expects
      d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
      use d_inode() rather than d_backing_inode() to get the inode pointer).
      
      Note that the dentry type field may be set to something other than
      DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
      manages the fall-through from a negative dentry to a lower layer.  In such a
      case, the dentry type of the negative union dentry is set to the same as the
      type of the lower dentry.
      
      However, if you know d_inode is not NULL at the call site, then you can use
      the d_is_xxx() functions even in a filesystem.
      
      There is one further complication: a 0,0 chardev dentry may be labelled
      DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
      intended for special directory entry types that don't have attached inodes.
      
      The following perl+coccinelle script was used:
      
      use strict;
      
      my @callers;
      open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
          die "Can't grep for S_ISDIR and co. callers";
      @callers = <$fd>;
      close($fd);
      unless (@callers) {
          print "No matches\n";
          exit(0);
      }
      
      my @cocci = (
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISLNK(E->d_inode->i_mode)',
          '+ d_is_symlink(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISDIR(E->d_inode->i_mode)',
          '+ d_is_dir(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISREG(E->d_inode->i_mode)',
          '+ d_is_reg(E)' );
      
      my $coccifile = "tmp.sp.cocci";
      open($fd, ">$coccifile") || die $coccifile;
      print($fd "$_\n") || die $coccifile foreach (@cocci);
      close($fd);
      
      foreach my $file (@callers) {
          chomp $file;
          print "Processing ", $file, "\n";
          system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
      	die "spatch failed";
      }
      
      [AV: overlayfs parts skipped]
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      e36cb0b8
    • David Howells's avatar
      SELinux: Use d_is_positive() rather than testing dentry->d_inode · 2c616d4d
      David Howells authored
      Use d_is_positive() rather than testing dentry->d_inode in SELinux to get rid
      of direct references to d_inode outside of the VFS.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      2c616d4d
    • David Howells's avatar
      Smack: Use d_is_positive() rather than testing dentry->d_inode · 8802565b
      David Howells authored
      Use d_is_positive() rather than testing dentry->d_inode in Smack to get rid of
      direct references to d_inode outside of the VFS.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      8802565b