Re: [PATCH] [47/48] Suspend2 2.1.9.8 for 2.6.12: 623-generic-block-io.patch

Pavel Machek
2005-07-10T18:24:54Z

Hi!

> +static int target_type = -1;
> +
> +/*
> +static char * description[7] = {
> + "Socket",
> + "Link",
> + "Regular file",
> + "Block device",
> + "Directory",
> + "Character device",
> + "Fifo",
> +};
> +*/
> +
...
> +/*
> + * Helpers.
> + */
> +
> +/*
> + * Return the type of target we have, an index into the descriptions
> + * above.
> + */
> +static int get_target_type(struct inode * inode)
> +{
> + switch (inode->i_mode & S_IFMT) {
> + case S_IFSOCK:
> + target_type = 0;
> + break;
> + case S_IFLNK:
> + target_type = 1;
> + break;
> + case S_IFREG:
> + target_type = 2;
> + break;
> + case S_IFBLK:
> + target_type = 3;
> + break;
> + case S_IFDIR:
> + target_type = 4;
> + break;
> + case S_IFCHR:
> + target_type = 5;
> + break;
> + case S_IFIFO:
> + target_type = 6;
> + break;
> + }
> + return target_type;
> +}
> +
> +#define target_is_usable (!(target_type == 1 || target_type == 4))
> +#define target_num_sectors (target_inode->i_size >> target_blkbits)

Why do you need this?
Pavel

--
teflon -- maybe it is a trademark, but it should not be.