Re: software suspend patch [2/6]

From: Pavel Machek
Date: Sun Nov 28 2004 - 12:11:38 EST


Hi!

> @@ -222,8 +221,105 @@ static void lock_swapdevices(void)
> }
> swap_list_unlock();
> }
> +
> +#define ONE_PAGE_PBE_NUM (PAGE_SIZE/sizeof(struct pbe))
> +#define PBE_IS_PAGE_END(x) \
> + ( PAGE_SIZE - sizeof(struct pbe) == ((x) - ((~(PAGE_SIZE - 1)) & (x))) )
> +
> +#define pgdir_for_each_safe(pos, n, head) \
> + for(pos = head, n = pos ? (suspend_pagedir_t*)pos->dummy.val : NULL; \
> + pos != NULL; \
> + pos = n, n = pos ? (suspend_pagedir_t *)pos->dummy.val : NULL)
> +
> +#define pbe_for_each_safe(pos, n, index, max, head) \
> + for(pos = head, index = 0, \
> + n = pos ? (struct pbe *)pos->dummy.val : NULL; \
> + (pos != NULL) && (index < max); \
> + pos = (PBE_IS_PAGE_END((unsigned long)pos)) ? n : \
> + ((struct pbe *)((unsigned long)pos + sizeof(struct pbe))), \
> + index ++, \
> + n = pos ? (struct pbe*)pos->dummy.val : NULL)
> +

_safe suffix means it is safe to delete while traversing. I do not
think your macros can handle that, so you should not have _safe
suffix.
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/