diff options
author | Nigel Cunningham <ncunningham@linuxmail.org> | 2006-12-06 23:34:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:27 -0500 |
commit | 7dfb71030f7636a0d65200158113c37764552f93 (patch) | |
tree | 276b812903d377b16d8828e888552fd256f48aab /include/linux/sched.h | |
parent | 8a05aac2631aa0e6494d9dc990f8c68ed8b8fde7 (diff) |
[PATCH] Add include/linux/freezer.h and move definitions from sched.h
Move process freezing functions from include/linux/sched.h to freezer.h, so
that modifications to the freezer or the kernel configuration don't require
recompiling just about everything.
[akpm@osdl.org: fix ueagle driver]
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index acfd2e15c5f2..837a012f573c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1618,87 +1618,6 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | |||
1618 | 1618 | ||
1619 | extern void normalize_rt_tasks(void); | 1619 | extern void normalize_rt_tasks(void); |
1620 | 1620 | ||
1621 | #ifdef CONFIG_PM | ||
1622 | /* | ||
1623 | * Check if a process has been frozen | ||
1624 | */ | ||
1625 | static inline int frozen(struct task_struct *p) | ||
1626 | { | ||
1627 | return p->flags & PF_FROZEN; | ||
1628 | } | ||
1629 | |||
1630 | /* | ||
1631 | * Check if there is a request to freeze a process | ||
1632 | */ | ||
1633 | static inline int freezing(struct task_struct *p) | ||
1634 | { | ||
1635 | return p->flags & PF_FREEZE; | ||
1636 | } | ||
1637 | |||
1638 | /* | ||
1639 | * Request that a process be frozen | ||
1640 | * FIXME: SMP problem. We may not modify other process' flags! | ||
1641 | */ | ||
1642 | static inline void freeze(struct task_struct *p) | ||
1643 | { | ||
1644 | p->flags |= PF_FREEZE; | ||
1645 | } | ||
1646 | |||
1647 | /* | ||
1648 | * Sometimes we may need to cancel the previous 'freeze' request | ||
1649 | */ | ||
1650 | static inline void do_not_freeze(struct task_struct *p) | ||
1651 | { | ||
1652 | p->flags &= ~PF_FREEZE; | ||
1653 | } | ||
1654 | |||
1655 | /* | ||
1656 | * Wake up a frozen process | ||
1657 | */ | ||
1658 | static inline int thaw_process(struct task_struct *p) | ||
1659 | { | ||
1660 | if (frozen(p)) { | ||
1661 | p->flags &= ~PF_FROZEN; | ||
1662 | wake_up_process(p); | ||
1663 | return 1; | ||
1664 | } | ||
1665 | return 0; | ||
1666 | } | ||
1667 | |||
1668 | /* | ||
1669 | * freezing is complete, mark process as frozen | ||
1670 | */ | ||
1671 | static inline void frozen_process(struct task_struct *p) | ||
1672 | { | ||
1673 | p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN; | ||
1674 | } | ||
1675 | |||
1676 | extern void refrigerator(void); | ||
1677 | extern int freeze_processes(void); | ||
1678 | extern void thaw_processes(void); | ||
1679 | |||
1680 | static inline int try_to_freeze(void) | ||
1681 | { | ||
1682 | if (freezing(current)) { | ||
1683 | refrigerator(); | ||
1684 | return 1; | ||
1685 | } else | ||
1686 | return 0; | ||
1687 | } | ||
1688 | #else | ||
1689 | static inline int frozen(struct task_struct *p) { return 0; } | ||
1690 | static inline int freezing(struct task_struct *p) { return 0; } | ||
1691 | static inline void freeze(struct task_struct *p) { BUG(); } | ||
1692 | static inline int thaw_process(struct task_struct *p) { return 1; } | ||
1693 | static inline void frozen_process(struct task_struct *p) { BUG(); } | ||
1694 | |||
1695 | static inline void refrigerator(void) {} | ||
1696 | static inline int freeze_processes(void) { BUG(); return 0; } | ||
1697 | static inline void thaw_processes(void) {} | ||
1698 | |||
1699 | static inline int try_to_freeze(void) { return 0; } | ||
1700 | |||
1701 | #endif /* CONFIG_PM */ | ||
1702 | #endif /* __KERNEL__ */ | 1621 | #endif /* __KERNEL__ */ |
1703 | 1622 | ||
1704 | #endif | 1623 | #endif |