summaryrefslogtreecommitdiffstats
path: root/drivers/char/misc.c
AgeCommit message (Expand)Author
2017-04-08drivers: char: misc: Replace printk with pr_err.Varsha Rao
2017-04-08drivers: char: misc: Add blank line after declaration.Varsha Rao
2017-04-08drivers: char: misc: Add space after ','.Varsha Rao
2017-04-08drivers: char: misc: Replace "foo * bar" with "foo *bar".Varsha Rao
2015-08-05char: make misc_deregister a void functionGreg Kroah-Hartman
2015-07-27char: misc: fix error pathSudip Mukherjee
2015-07-27char: misc: remove redundant ifdefSudip Mukherjee
2015-06-01char: misc: restore MISC_DYNAMIC_MINOR on device_create() failureVladimir Zapolskiy
2015-05-24drivers: char: misc.c: remove trailing whitespaceTal Shorer
2015-04-03misc: pass miscdevice through file's private_dataTom Van Braeckel
2015-03-25misc: Add attribute groupsTakashi Iwai
2015-03-25char: misc: document behaviour of open()Martin Kepplinger
2013-11-13Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vir...Linus Torvalds
2013-10-24consolidate the reassignments of ->f_op in ->open() instancesAl Viro
2013-09-26Drivers: char: misc: 'misc_deregister()' changed the 'mutex_unlock' logic upo...Elad Wexler
2013-02-27drivers/char/misc.c:misc_register(): do not loop on misc_list unconditionallyDae S. Kim
2012-01-03switch device_get_devnode() and ->devnode() to umode_t *Al Viro
2010-10-15llseek: automatically add .llseek fopArnd Bergmann
2010-08-09char: add WARN_ON() in misc_deregister()Akinobu Mita
2010-05-25drivers: misc: pass miscdevice pointer via file private dataSamu Onkalo
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking imp...Tejun Heo
2009-12-15drivers/char/misc.c: use bitmap/bitops functions for dynamic minor number all...Thadeu Lima de Souza Cascardo
2009-12-15drivers/char/misc.c: clear allocation bit in minor bitmap when device registe...Thadeu Lima de Souza Cascardo
2009-12-15misc: remove MAC pmu function declaration from misc device classThadeu Lima de Souza Cascardo
2009-10-14drivers: Remove BKL from misc_openThomas Gleixner
2009-09-23seq_file: constify seq_operationsJames Morris
2009-09-19Driver-Core: extend devnode callbacks to provide permissionsKay Sievers
2009-06-15Driver Core: misc: add nodename support for misc devices.Kay Sievers
2008-10-16device create: char: convert device_create_drvdata to device_createGreg Kroah-Hartman
2008-07-21device create: char: convert device_create to device_create_drvdataGreg Kroah-Hartman
2008-06-20misc: cdev lock_kernel() pushdownJonathan Corbet
2008-04-29drivers: use non-racy method for proc entries creationDenis V. Lunev
2008-04-19PM: Remove destroy_suspended_device()Rafael J. Wysocki
2008-02-05Misc: Add possibility to remove misc devices during suspend/resumeRafael J. Wysocki
2007-07-16Make /proc/misc use seq_list_xxx helpersPavel Emelianov
2007-05-08use mutex instead of semaphore for misc char devicesMatthias Kaehlcke
2006-12-07[PATCH] Correct misc_register return code handling in several driversNeil Horman
2006-12-01Driver core: change misc class_devices to be real devicesGreg Kroah-Hartman
2006-07-03[PATCH] make more file_operation structs staticArjan van de Ven
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel
2006-06-26[PATCH] devfs: Remove the miscdevice devfs_name field as it's no longer neededGreg Kroah-Hartman
2006-06-26[PATCH] devfs: Remove the devfs_fs_kernel.h file from the treeGreg Kroah-Hartman
2006-06-26[PATCH] devfs: Remove devfs_remove() function from the kernel treeGreg Kroah-Hartman
2006-06-26[PATCH] devfs: Remove devfs_mk_cdev() function from the kernel treeGreg Kroah-Hartman
2006-03-28[PATCH] mark f_ops const in the inodeArjan van de Ven
2005-10-28[PATCH] Driver Core: fix up all callers of class_device_create()Greg Kroah-Hartman
2005-09-07[PATCH] move m68k rtc drivers over to initcallsChristoph Hellwig
2005-06-27[PATCH] ppc32: Remove CONFIG_PMAC_PBOOKBenjamin Herrenschmidt
2005-06-25[PATCH] I8K: initialization code cleanup; formattingDmitry Torokhov
2005-06-25[PATCH] Toshiba driver cleanupDmitry Torokhov
> 375 376 377 378 379 380 381 382
#     ____      ____
#    / __/___  / __/
#   / /_/_  / / /_
#  / __/ / /_/ __/
# /_/   /___/_/ completion.bash
#
# - $FZF_TMUX               (default: 0)
# - $FZF_TMUX_OPTS          (default: empty)
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS    (default: empty)

if [[ $- =~ i ]]; then

# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -f _fzf_compgen_path > /dev/null; then
  _fzf_compgen_path() {
    echo "$1"
    command find -L "$1" \
      -name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
      -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
  }
fi

if ! declare -f _fzf_compgen_dir > /dev/null; then
  _fzf_compgen_dir() {
    command find -L "$1" \
      -name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
      -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
  }
fi

###########################################################

# To redraw line after fzf closes (printf '\e[5n')
bind '"\e[0n": redraw-current-line' 2> /dev/null

__fzf_comprun() {
  if [[ "$(type -t _fzf_comprun 2>&1)" = function ]]; then
    _fzf_comprun "$@"
  elif [[ -n "${TMUX_PANE-}" ]] && { [[ "${FZF_TMUX:-0}" != 0 ]] || [[ -n "${FZF_TMUX_OPTS-}" ]]; }; then
    shift
    fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- "$@"
  else
    shift
    fzf "$@"
  fi
}

__fzf_orig_completion() {
  local l comp f cmd
  while read -r l; do
    if [[ "$l" =~ ^(.*\ -F)\ *([^ ]*).*\ ([^ ]*)$ ]]; then
      comp="${BASH_REMATCH[1]}"
      f="${BASH_REMATCH[2]}"
      cmd="${BASH_REMATCH[3]}"
      [[ "$f" = _fzf_* ]] && continue
      printf -v "_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}" "%s" "${comp} %s ${cmd} #${f}"
      if [[ "$l" = *" -o nospace "* ]] && [[ ! "${__fzf_nospace_commands-}" = *" $cmd "* ]]; then
        __fzf_nospace_commands="${__fzf_nospace_commands-} $cmd "
      fi
    fi
  done
}

_fzf_opts_completion() {
  local cur prev opts
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  prev="${COMP_WORDS[COMP_CWORD-1]}"
  opts="
    -x --extended
    -e --exact
    --algo
    -i +i
    -n --nth
    --with-nth
    -d --delimiter
    +s --no-sort
    --tac
    --tiebreak
    -m --multi
    --no-mouse
    --bind
    --cycle
    --no-hscroll
    --jump-labels
    --height
    --literal
    --reverse
    --margin
    --inline-info
    --prompt
    --pointer
    --marker
    --header
    --header-lines
    --ansi
    --tabstop
    --color
    --no-bold
    --history
    --history-size
    --preview
    --preview-window
    -q --query
    -1 --select-1
    -0 --exit-0
    -f --filter
    --print-query
    --expect
    --sync"

  case "${prev}" in
  --tiebreak)
    COMPREPLY=( $(compgen -W "length begin end index" -- "$cur") )
    return 0
    ;;
  --color)
    COMPREPLY=( $(compgen -W "dark light 16 bw" -- "$cur") )
    return 0
    ;;
  --history)
    COMPREPLY=()
    return 0
    ;;
  esac

  if [[ "$cur" =~ ^-|\+ ]]; then
    COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
    return 0
  fi

  return 0
}

_fzf_handle_dynamic_completion() {
  local cmd orig_var orig ret orig_cmd orig_complete
  cmd="$1"
  shift
  orig_cmd="$1"
  orig_var="_fzf_orig_completion_$cmd"
  orig="${!orig_var-}"
  orig="${orig##*#}"
  if [[ -n "$orig" ]] && type "$orig" > /dev/null 2>&1; then
    $orig "$@"
  elif [[ -n "${_fzf_completion_loader-}" ]]; then
    orig_complete=$(complete -p "$orig_cmd" 2> /dev/null)
    _completion_loader "$@"
    ret=$?
    # _completion_loader may not have updated completion for the command
    if [[ "$(complete -p "$orig_cmd" 2> /dev/null)" != "$orig_complete" ]]; then
      __fzf_orig_completion < <(complete -p "$orig_cmd" 2> /dev/null)
      if [[ "${__fzf_nospace_commands-}" = *" $orig_cmd "* ]]; then
        eval "${orig_complete/ -F / -o nospace -F }"
      else
        eval "$orig_complete"
      fi
    fi
    return $ret
  fi
}

__fzf_generic_path_completion() {
  local cur base dir leftover matches trigger cmd
  cmd="${COMP_WORDS[0]}"
  if [[ $cmd == \\* ]]; then
    cmd="${cmd:1}"
  fi
  cmd="${cmd//[^A-Za-z0-9_=]/_}"
  COMPREPLY=()
  trigger=${FZF_COMPLETION_TRIGGER-'**'}
  cur="${COMP_WORDS[COMP_CWORD]}"
  if [[ "$cur" == *"$trigger" ]]; then
    base=${cur:0:${#cur}-${#trigger}}
    eval "base=$base"

    dir=
    [[ $base = *"/"* ]] && dir="$base"
    while true; do
      if [[ -z "$dir" ]] || [[ -d "$dir" ]]; then
        leftover=${base/#"$dir"}
        leftover=${leftover/#\/}
        [[ -z "$dir" ]] && dir='.'
        [[ "$dir" != "/" ]] && dir="${dir/%\//}"
        matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $2" __fzf_comprun "$4" -q "$leftover" | while read -r item; do
          printf "%q " "${item%$3}$3"
        done)
        matches=${matches% }
        [[ -z "$3" ]] && [[ "${__fzf_nospace_commands-}" = *" ${COMP_WORDS[0]} "* ]] && matches="$matches "
        if [[ -n "$matches" ]]; then
          COMPREPLY=( "$matches" )
        else
          COMPREPLY=( "$cur" )
        fi
        printf '\e[5n'
        return 0
      fi
      dir=$(dirname "$dir")
      [[ "$dir" =~ /$ ]] || dir="$dir"/
    done
  else
    shift
    shift
    shift
    _fzf_handle_dynamic_completion "$cmd" "$@"
  fi
}

_fzf_complete() {
  # Split arguments around --
  local args rest str_arg i sep
  args=("$@")
  sep=
  for i in "${!args[@]}"; do
    if [[ "${args[$i]}" = -- ]]; then
      sep=$i
      break
    fi
  done
  if [[ -n "$sep" ]]; then
    str_arg=
    rest=("${args[@]:$((sep + 1)):${#args[@]}}")
    args=("${args[@]:0:$sep}")
  else
    str_arg=$1
    args=()
    shift
    rest=("$@")
  fi

  local cur selected trigger cmd post
  post="$(caller 0 | awk '{print $2}')_post"
  type -t "$post" > /dev/null 2>&1 || post=cat

  cmd="${COMP_WORDS[0]//[^A-Za-z0-9_=]/_}"
  trigger=${FZF_COMPLETION_TRIGGER-'**'}
  cur="${COMP_WORDS[COMP_CWORD]}"
  if [[ "$cur" == *"$trigger" ]]; then
    c