summaryrefslogtreecommitdiffstats
path: root/fs/exofs/inode.c
AgeCommit message (Expand)Author
2016-12-10exofs: don't mess with simple_write_{begin,end}Al Viro
2016-10-11fs: use mapping_set_error instead of opencoded set_bitMichal Hocko
2016-10-10Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vir...Linus Torvalds
2016-09-27fs: Replace CURRENT_TIME with current_time() for inode timestampsDeepa Dinamani
2016-09-22fs: Give dentry to inode_change_ok() instead of inodeJan Kara
2016-05-01direct-io: eliminate the offset argument to ->direct_IOChristoph Hellwig
2016-04-04mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macrosKirill A. Shutemov
2016-01-11Merge branch 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git...Linus Torvalds
2015-12-12osd fs: __r4w_get_page rely on PageUptodate for uptodateHugh Dickins
2015-12-08don't put symlink bodies in pagecache into highmemAl Viro
2015-05-10exofs: switch to {simple,page}_symlink_inode_operationsAl Viro
2015-04-15VFS: normal filesystems (and lustre): d_inode() annotationsDavid Howells
2015-04-11direct_IO: remove rw from a_ops->direct_IO()Omar Sandoval
2015-02-16vfs: remove get_xip_memMatthew Wilcox
2015-01-20fs: remove mapping->backing_dev_infoChristoph Hellwig
2014-10-19Boaz Harrosh - Fix broken email addressBoaz Harrosh
2014-05-06pass iov_iter to ->direct_IO()Al Viro
2014-04-03mm + fs: store shadow entries in page cacheJohannes Weiner
2014-01-23exofs: Print less in r4wBoaz Harrosh
2014-01-23exofs: Allow corrupted directory entry to be empty fileBoaz Harrosh
2014-01-23exofs: Allow O_DIRECT openBoaz Harrosh
2013-09-12truncate: drop 'oldsize' truncate_pagecache() parameterKirill A. Shutemov
2013-05-21mm: change invalidatepage prototype to accept lengthLukas Czerner
2012-12-14exofs: don't leak io_state and pages on read errorBoaz Harrosh
2012-12-11exofs: clean up the correct page collection on write errorIdan Kedar
2012-10-02Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebi...Linus Torvalds
2012-09-21userns: Convert exofs to use kuid/kgid where appropriateEric W. Biederman
2012-08-02exofs: Use proper max_IO calculations from oreBoaz Harrosh
2012-08-02exofs: Fix __r4w_get_page when offset is beyond i_sizeBoaz Harrosh
2012-08-02exofs: readpage_strip: Add a BUG_ON to check for PageLocked(page)Kautuk Consul
2012-05-06vfs: Rename end_writeback() to clear_inode()Jan Kara
2012-01-03exofs: propagate umode_tAl Viro
2011-11-02filesystems: add set_nlink()Miklos Szeredi
2011-10-24exofs: Support for RAID5 read-4-write interface.Boaz Harrosh
2011-10-14ore/exofs: Change ore_check_io APIBoaz Harrosh
2011-10-14ore/exofs: Define new ore_verify_layoutBoaz Harrosh
2011-10-14exofs: Support for short read/writesBoaz Harrosh
2011-10-14ore: Only IO one group at a time (API change)Boaz Harrosh
2011-10-03exofs: Rename struct ore_components comps => ocBoaz Harrosh
2011-08-06exofs: Rename raid engine from exofs/ios.c => oreBoaz Harrosh
2011-08-06exofs: ios: Move to a per inode components & device-tableBoaz Harrosh
2011-08-06exofs: Move exofs specific osd operations out of ios.cBoaz Harrosh
2011-08-06exofs: Add offset/length to exofs_get_io_stateBoaz Harrosh
2011-03-24Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-blockLinus Torvalds
2011-03-15exofs: Write sbi->s_nextid as part of the Create commandBoaz Harrosh
2011-03-15exofs: Override read-ahead to align on stripe_sizebharrosh@panasas.com
2011-03-15exofs: simple fsync race fixNick Piggin
2011-03-15exofs: Optimize read_4_writeBoaz Harrosh
2011-03-10block: remove per-queue pluggingJens Axboe
2011-02-02Revert "exofs: Set i_mapping->backing_dev_info anyway"Boaz Harrosh
rd.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
use strum_macros::{Display, EnumIter, EnumString};

use crate::config::Colors;
use crate::event_exec::EventExec;
use crate::fm_error::FmResult;
use crate::status::Status;

/// Different kind of action which can be mapped to a key.
/// All those actions are mapped to a key and this enum
/// makes the junction between received Key events and
/// actions in the application.
#[derive(Clone, Debug, Display, EnumString, EnumIter)]
pub enum ActionMap {
    Back,
    BackTab,
    Backspace,
    Bulkrename,
    Chmod,
    ClearFlags,
    Command,
    Compress,
    CopyFilename,
    CopyFilepath,
    CopyPaste,
    CutPaste,
    Delete,
    DeleteFile,
    ToggleDisplayFull,
    DragNDrop,
    EncryptedDrive,
    End,
    Enter,
    Exec,
    Filter,
    FlagAll,
    FuzzyFind,
    FuzzyFindLine,
    GitRoot,
    Goto,
    Help,
    History,
    Home,
    Jump,
    KeyHome,
    Lazygit,
    MarksJump,
    MarksNew,
    ModeNormal,
    MoveDown,
    MoveLeft,
    MoveRight,
    MoveUp,
    NewDir,
    NewFile,
    Nothing,
    NvimFilepicker,
    NvimSetAddress,
    OpenConfig,
    OpenFile,
    PageDown,
    PageUp,
    Preview,
    Quit,
    RefreshView,
    RegexMatch,
    Rename,
    ReverseFlags,
    Search,
    SearchNext,
    Shell,
    Shortcut,
    Sort,
    Symlink,
    Tab,
    MediaInfo,
    ToggleDualPane,
    ToggleFlag,
    ToggleHidden,
    TogglePreviewSecond,
    TrashMoveFile,
    TrashRestoreFile,
    TrashEmpty,
    TrashOpen,
    Tree,
    TreeFold,
    TreeUnFoldAll,
    TreeFoldAll,
}

impl ActionMap {
    /// Makes the junction between `Actions` and `Events`.
    /// Every Action links to a different `EventExec` method.
    pub fn matcher(&self, status: &mut Status, colors: &Colors) -> FmResult<()> {
        let current_tab = status.selected();
        match *self {
            ActionMap::Back => EventExec::event_back(status, colors),
            ActionMap::BackTab => EventExec::backtab(status),
            ActionMap::Backspace => EventExec::event_backspace(status),
            ActionMap::Bulkrename => EventExec::event_bulkrename(status),
            ActionMap::Chmod => EventExec::event_chmod(status),
            ActionMap::ClearFlags => EventExec::event_clear_flags(status),
            ActionMap::Command => EventExec::event_command(current_tab),
            ActionMap::Compress => EventExec::event_compress(status),
            ActionMap::CopyFilename => EventExec::event_copy_filename(status),
            ActionMap::CopyFilepath => EventExec::event_copy_filepath(status),
            ActionMap::CopyPaste => EventExec::event_copy_paste(status),
            ActionMap::CutPaste => EventExec::event_cut_paste(status),
            ActionMap::Delete => EventExec::event_delete(status),
            ActionMap::DeleteFile => EventExec::event_delete_file(status),
            ActionMap::ToggleDisplayFull => EventExec::event_toggle_display_full(status),
            ActionMap::DragNDrop => EventExec::event_drag_n_drop(status),
            ActionMap::EncryptedDrive => EventExec::event_encrypted_drive(status),
            ActionMap::End => EventExec::event_end(status, colors),
            ActionMap::Enter => EventExec::event_enter(status, colors),
            ActionMap::Exec => EventExec::event_exec(current_tab),
            ActionMap::Filter => EventExec::event_filter(current_tab),
            ActionMap::FlagAll => EventExec::event_flag_all(status),
            ActionMap::FuzzyFind => EventExec::event_fuzzyfind(status),
            ActionMap::FuzzyFindLine => EventExec::event_fuzzyfind_line(status),
            ActionMap::GitRoot => EventExec::event_git_root(current_tab),
            ActionMap::Goto => EventExec::event_goto(current_tab),
            ActionMap::Help => EventExec::event_help(status),
            ActionMap::History => EventExec::event_history(current_tab),
            ActionMap::Home => EventExec::event_home(current_tab),
            ActionMap::Lazygit => EventExec::event_lazygit(status),
            ActionMap::Jump => EventExec::event_jump(status),
            ActionMap::KeyHome => EventExec::event_key_home(status, colors),
            ActionMap::MarksJump => EventExec::event_marks_jump(status),
            ActionMap::MarksNew => EventExec::event_marks_new(current_tab),
            ActionMap::ModeNormal => EventExec::event_reset_mode(current_tab),
            ActionMap::MoveDown => EventExec::event_move_down(status, colors),
            ActionMap::MoveLeft => EventExec::event_move_left(status, colors),
            ActionMap::MoveRight => EventExec::event_move_right(status, colors),
            ActionMap::MoveUp => EventExec::event_move_up(status, colors),
            ActionMap::NewDir => EventExec::event_new_dir(current_tab),
            ActionMap::NewFile => EventExec::event_new_file(current_tab),
            ActionMap::NvimFilepicker => EventExec::event_nvim_filepicker(status),
            ActionMap::NvimSetAddress => EventExec::event_set_nvim_server(status),
            ActionMap::OpenFile => EventExec::event_open_file(status),
            ActionMap::PageDown => EventExec::event_page_down(status, colors),
            ActionMap::PageUp => EventExec::event_page_up(status, colors),
            ActionMap::Preview => EventExec::event_preview(status, colors),
            ActionMap::Quit => EventExec::event_quit(current_tab),
            ActionMap::RefreshView => EventExec::event_refreshview(status, colors),
            ActionMap::RegexMatch => EventExec::event_regex_match(current_tab),
            ActionMap::Rename => EventExec::event_rename(current_tab),
            ActionMap::ReverseFlags => EventExec::event_reverse_flags(status),
            ActionMap::Search => EventExec::event_search(current_tab),
            ActionMap::SearchNext => EventExec::event_search_next(current_tab),
            ActionMap::Shell => EventExec::event_shell(status),
            ActionMap::Shortcut => EventExec::event_shortcut(current_tab),
            ActionMap::Sort => EventExec::event_sort(current_tab),
            ActionMap::Symlink => EventExec::event_symlink(status),
            ActionMap::Tab => EventExec::event_tab(status),
            ActionMap::MediaInfo => EventExec::event_mediainfo(current_tab),
            ActionMap::ToggleDualPane => EventExec::event_toggle_dualpane(status),
            ActionMap::ToggleFlag => EventExec::event_toggle_flag(status),
            ActionMap::ToggleHidden => EventExec::event_toggle_hidden(status, colors),
            ActionMap::TogglePreviewSecond => EventExec::event_toggle_preview_second(status),
            ActionMap::TrashMoveFile => EventExec::event_trash_move_file(status),
            ActionMap::TrashRestoreFile => EventExec::event_trash_restore_file(status),
            ActionMap::TrashEmpty => EventExec::exec_trash_empty(status),
            ActionMap::TrashOpen => EventExec::event_trash_open(status),
            ActionMap::Tree => EventExec::event_tree(status, colors),
            ActionMap::TreeFold => EventExec::event_tree_fold(current_tab, colors),
            ActionMap::TreeFoldAll => EventExec::event_tree_fold_all(current_tab, colors),
            ActionMap::TreeUnFoldAll => EventExec::event_tree_unfold_all(current_tab, colors),
            ActionMap::OpenConfig => EventExec::event_open_config(status),

            ActionMap::Nothing => Ok(()),
        }
    }
}