Lines Matching refs:action_data

700 static int eval_expr_log(struct expr *expr, struct action_data *action_data)  in eval_expr_log()  argument
707 match = expr->atom.test->fn(&expr->atom, action_data); in eval_expr_log()
712 match = !eval_expr_log(expr->unary_op.expr, action_data); in eval_expr_log()
716 match = eval_expr_log(expr->expr_op.lhs, action_data); in eval_expr_log()
721 match = eval_expr_log(expr->expr_op.rhs, action_data); in eval_expr_log()
731 static int eval_expr(struct expr *expr, struct action_data *action_data) in eval_expr() argument
737 match = expr->atom.test->fn(&expr->atom, action_data); in eval_expr()
740 match = !eval_expr(expr->unary_op.expr, action_data); in eval_expr()
743 match = eval_expr(expr->expr_op.lhs, action_data); in eval_expr()
747 match = eval_expr(expr->expr_op.rhs, action_data); in eval_expr()
755 static int eval_expr_top(struct action *action, struct action_data *action_data) in eval_expr_top() argument
762 if(action_data->subpath) in eval_expr_top()
763 expr_log(action_data->subpath); in eval_expr_top()
780 match = eval_expr_log(action->expr, action_data); in eval_expr_top()
794 return eval_expr(action->expr, action_data); in eval_expr_top()
883 struct action_data action_data; in eval_actions() local
886 action_data.name = dir_ent->name; in eval_actions()
887 action_data.pathname = strdup(pathname(dir_ent)); in eval_actions()
888 action_data.subpath = strdup(subpathname(dir_ent)); in eval_actions()
889 action_data.buf = &dir_ent->inode->buf; in eval_actions()
890 action_data.depth = dir_ent->our_dir->depth; in eval_actions()
891 action_data.dir_ent = dir_ent; in eval_actions()
892 action_data.root = root; in eval_actions()
901 match = eval_expr_top(action, &action_data); in eval_actions()
907 free(action_data.pathname); in eval_actions()
908 free(action_data.subpath); in eval_actions()
918 struct action_data action_data; in eval_frag_actions() local
920 action_data.name = dir_ent->name; in eval_frag_actions()
921 action_data.pathname = strdup(pathname(dir_ent)); in eval_frag_actions()
922 action_data.subpath = strdup(subpathname(dir_ent)); in eval_frag_actions()
923 action_data.buf = &dir_ent->inode->buf; in eval_frag_actions()
924 action_data.depth = dir_ent->our_dir->depth; in eval_frag_actions()
925 action_data.dir_ent = dir_ent; in eval_frag_actions()
926 action_data.root = root; in eval_frag_actions()
929 match = eval_expr_top(&fragment_spec[i], &action_data); in eval_frag_actions()
931 free(action_data.pathname); in eval_frag_actions()
932 free(action_data.subpath); in eval_frag_actions()
937 free(action_data.pathname); in eval_frag_actions()
938 free(action_data.subpath); in eval_frag_actions()
979 struct action_data action_data; in eval_exclude_actions() local
981 action_data.name = name; in eval_exclude_actions()
982 action_data.pathname = pathname; in eval_exclude_actions()
983 action_data.subpath = subpath; in eval_exclude_actions()
984 action_data.buf = buf; in eval_exclude_actions()
985 action_data.depth = depth; in eval_exclude_actions()
986 action_data.dir_ent = dir_ent; in eval_exclude_actions()
989 match = eval_expr_top(&exclude_spec[i], &action_data); in eval_exclude_actions()
1513 struct action_data action_data; in eval_empty_actions() local
1523 action_data.name = dir_ent->name; in eval_empty_actions()
1524 action_data.pathname = strdup(pathname(dir_ent)); in eval_empty_actions()
1525 action_data.subpath = strdup(subpathname(dir_ent)); in eval_empty_actions()
1526 action_data.buf = &dir_ent->inode->buf; in eval_empty_actions()
1527 action_data.depth = dir_ent->our_dir->depth; in eval_empty_actions()
1528 action_data.dir_ent = dir_ent; in eval_empty_actions()
1529 action_data.root = root; in eval_empty_actions()
1552 match = eval_expr_top(&empty_spec[i], &action_data); in eval_empty_actions()
1555 free(action_data.pathname); in eval_empty_actions()
1556 free(action_data.subpath); in eval_empty_actions()
1628 void eval_move(struct action_data *action_data, struct move_ent *move, in eval_move() argument
1692 action_data->subpath, path, comp); in eval_move()
1696 action_data->subpath, path, comp); in eval_move()
1712 action_data->subpath, path, conf_path); in eval_move()
1736 action_data->subpath, path, conf_path); in eval_move()
1764 struct action_data action_data; in eval_move_actions() local
1767 action_data.name = dir_ent->name; in eval_move_actions()
1768 action_data.pathname = strdup(pathname(dir_ent)); in eval_move_actions()
1769 action_data.subpath = strdup(subpathname(dir_ent)); in eval_move_actions()
1770 action_data.buf = &dir_ent->inode->buf; in eval_move_actions()
1771 action_data.depth = dir_ent->our_dir->depth; in eval_move_actions()
1772 action_data.dir_ent = dir_ent; in eval_move_actions()
1773 action_data.root = root; in eval_move_actions()
1786 int match = eval_expr_top(action, &action_data); in eval_move_actions()
1797 eval_move(&action_data, move, root, dir_ent, in eval_move_actions()
1825 action_data.subpath, conf_path); in eval_move_actions()
1839 action_data.subpath, conf_path); in eval_move_actions()
1849 free(action_data.pathname); in eval_move_actions()
1850 free(action_data.subpath); in eval_move_actions()
1989 struct action_data action_data; in eval_prune_actions() local
1991 action_data.name = dir_ent->name; in eval_prune_actions()
1992 action_data.pathname = strdup(pathname(dir_ent)); in eval_prune_actions()
1993 action_data.subpath = strdup(subpathname(dir_ent)); in eval_prune_actions()
1994 action_data.buf = &dir_ent->inode->buf; in eval_prune_actions()
1995 action_data.depth = dir_ent->our_dir->depth; in eval_prune_actions()
1996 action_data.dir_ent = dir_ent; in eval_prune_actions()
1997 action_data.root = root; in eval_prune_actions()
2000 match = eval_expr_top(&prune_spec[i], &action_data); in eval_prune_actions()
2002 free(action_data.pathname); in eval_prune_actions()
2003 free(action_data.subpath); in eval_prune_actions()
2174 static int NAME##_fn(struct atom *atom, struct action_data *action_data) \
2177 if (!file_type_match(action_data->buf->st_mode, MATCH)) \
2245 return fnmatch(atom->argv[0], action_data->name,
2249 return fnmatch(atom->argv[0], action_data->subpath,
2289 static int subpathname_fn(struct atom *atom, struct action_data *action_data) in subpathname_fn() argument
2291 char *path = strdup(action_data->subpath); in subpathname_fn()
2305 TEST_VAR_FN(filesize, ACTION_REG, action_data->buf->st_size)
2307 TEST_VAR_FN(dirsize, ACTION_DIR, action_data->buf->st_size)
2309 TEST_VAR_FN(size, ACTION_ALL_LNK, action_data->buf->st_size)
2311 TEST_VAR_FN(inode, ACTION_ALL_LNK, action_data->buf->st_ino)
2313 TEST_VAR_FN(nlink, ACTION_ALL_LNK, action_data->buf->st_nlink)
2315 TEST_VAR_FN(fileblocks, ACTION_REG, action_data->buf->st_blocks)
2317 TEST_VAR_FN(dirblocks, ACTION_DIR, action_data->buf->st_blocks)
2319 TEST_VAR_FN(blocks, ACTION_ALL_LNK, action_data->buf->st_blocks)
2321 TEST_VAR_FN(dircount, ACTION_DIR, action_data->dir_ent->dir->count)
2323 TEST_VAR_FN(depth, ACTION_ALL_LNK, action_data->depth)
2325 TEST_VAR_RANGE_FN(filesize, ACTION_REG, action_data->buf->st_size)
2327 TEST_VAR_RANGE_FN(dirsize, ACTION_DIR, action_data->buf->st_size)
2329 TEST_VAR_RANGE_FN(size, ACTION_ALL_LNK, action_data->buf->st_size)
2331 TEST_VAR_RANGE_FN(inode, ACTION_ALL_LNK, action_data->buf->st_ino)
2333 TEST_VAR_RANGE_FN(nlink, ACTION_ALL_LNK, action_data->buf->st_nlink)
2335 TEST_VAR_RANGE_FN(fileblocks, ACTION_REG, action_data->buf->st_blocks)
2337 TEST_VAR_RANGE_FN(dirblocks, ACTION_DIR, action_data->buf->st_blocks)
2339 TEST_VAR_RANGE_FN(blocks, ACTION_ALL_LNK, action_data->buf->st_blocks)
2341 TEST_VAR_RANGE_FN(gid, ACTION_ALL_LNK, action_data->buf->st_gid)
2343 TEST_VAR_RANGE_FN(uid, ACTION_ALL_LNK, action_data->buf->st_uid)
2345 TEST_VAR_RANGE_FN(depth, ACTION_ALL_LNK, action_data->depth)
2347 TEST_VAR_RANGE_FN(dircount, ACTION_DIR, action_data->dir_ent->dir->count)
2352 TEST_VAR_FN(uid, ACTION_ALL_LNK, action_data->buf->st_uid)
2397 TEST_VAR_FN(gid, ACTION_ALL_LNK, action_data->buf->st_gid)
2477 static int type_fn(struct atom *atom, struct action_data *action_data) in type_fn() argument
2481 return (action_data->buf->st_mode & S_IFMT) == type->value; in type_fn()
2488 static int true_fn(struct atom *atom, struct action_data *action_data) in true_fn() argument
2497 static int false_fn(struct atom *atom, struct action_data *action_data) in false_fn() argument
2531 static int file_fn(struct atom *atom, struct action_data *action_data) in file_fn() argument
2556 execlp("file", "file", "-b", action_data->pathname, in file_fn()
2605 static int exec_fn(struct atom *atom, struct action_data *action_data) in exec_fn() argument
2640 res = setenv("NAME", action_data->name, 1); in exec_fn()
2644 res = setenv("PATHNAME", action_data->subpath, 1); in exec_fn()
2648 res = setenv("SOURCE_PATHNAME", action_data->pathname, 1); in exec_fn()
2753 static int exists_fn(struct atom *atom, struct action_data *action_data) in exists_fn() argument
2772 if (!file_type_match(action_data->buf->st_mode, ACTION_LNK)) in exists_fn()
2776 return follow_path(action_data->dir_ent->our_dir, in exists_fn()
2777 action_data->dir_ent->inode->symlink) ? 1 : 0; in exists_fn()
2781 static int absolute_fn(struct atom *atom, struct action_data *action_data) in absolute_fn() argument
2796 if (!file_type_match(action_data->buf->st_mode, ACTION_LNK)) in absolute_fn()
2799 return action_data->dir_ent->inode->symlink[0] == '/'; in absolute_fn()
2844 static int stat_fn(struct atom *atom, struct action_data *action_data) in stat_fn() argument
2847 struct action_data eval_action; in stat_fn()
2865 res = stat(action_data->pathname, &buf); in stat_fn()
2878 memcpy(&eval_action, action_data, sizeof(struct action_data)); in stat_fn()
2893 static int readlink_fn(struct atom *atom, struct action_data *action_data) in readlink_fn() argument
2897 struct action_data eval_action; in readlink_fn()
2914 if (!file_type_match(action_data->buf->st_mode, ACTION_LNK)) in readlink_fn()
2918 dir_ent = follow_path(action_data->dir_ent->our_dir, in readlink_fn()
2919 action_data->dir_ent->inode->symlink); in readlink_fn()
2929 eval_action.root = action_data->root; in readlink_fn()
2956 static int eval_fn(struct atom *atom, struct action_data *action_data) in eval_fn() argument
2960 struct dir_ent *dir_ent = action_data->dir_ent; in eval_fn()
2961 struct stat *buf = action_data->buf; in eval_fn()
2962 struct action_data eval_action; in eval_fn()
2987 dir_ent = action_data->root->dir_ent; in eval_fn()
2989 dir_ent = follow_path(action_data->root, path); in eval_fn()
3031 eval_action.root = action_data->root; in eval_fn()
3116 static int perm_fn(struct atom *atom, struct action_data *action_data) in perm_fn() argument
3119 struct stat *buf = action_data->buf; in perm_fn()