-#ifdef CONFIG_SOFTWARE_SUSPEND
-/*
- * Find the swap type that corresponds to given device (if any)
- *
- * This is needed for software suspend and is done in such a way that inode
- * aliasing is allowed.
- */
-int swap_type_of(dev_t device)
-{
- int i;
-
- spin_lock(&swap_lock);
- for (i = 0; i < nr_swapfiles; i++) {
- struct inode *inode;
-
- if (!(swap_info[i].flags & SWP_WRITEOK))
- continue;
-
- if (!device) {
- spin_unlock(&swap_lock);
- return i;
- }
- inode = swap_info[i].swap_file->f_dentry->d_inode;
- if (S_ISBLK(inode->i_mode) &&
- device == MKDEV(imajor(inode), iminor(inode))) {
- spin_unlock(&swap_lock);
- return i;
- }
- }
- spin_unlock(&swap_lock);
- return -ENODEV;
-}
-
-/*
- * Return either the total number of swap pages of given type, or the number
- * of free pages of that type (depending on @free)
- *
- * This is needed for software suspend
- */
-unsigned int count_swap_pages(int type, int free)
-{
- unsigned int n = 0;
-
- if (type < nr_swapfiles) {
- spin_lock(&swap_lock);
- if (swap_info[type].flags & SWP_WRITEOK) {
- n = swap_info[type].pages;
- if (free)
- n -= swap_info[type].inuse_pages;
- }
- spin_unlock(&swap_lock);
- }
- return n;
-}
-#endif
-