lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[Suspend2][ 17/35] [Suspend2] Filewriter initrd image support.
    Date
    First cut support for making the initrd itself the image.

    Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

    kernel/power/suspend_file.c | 38 ++++++++++++++++++++++++++++++++++++++
    1 files changed, 38 insertions(+), 0 deletions(-)

    diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
    index 46527f1..6f298fc 100644
    --- a/kernel/power/suspend_file.c
    +++ b/kernel/power/suspend_file.c
    @@ -544,3 +544,41 @@ static int filewriter_write_header_clean
    return 0;
    }

    +/* HEADER READING */
    +
    +#ifdef CONFIG_DEVFS_FS
    +int create_dev(char *name, dev_t dev, char *devfs_name);
    +#else
    +static int create_dev(char *name, dev_t dev, char *devfs_name)
    +{
    + sys_unlink(name);
    + return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
    +}
    +#endif
    +
    +static int rd_init(void)
    +{
    + suspend_writer_buffer_posn = 0;
    +
    + create_dev("/dev/root", ROOT_DEV, root_device_name);
    + create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, 0), NULL);
    +
    + suspend_read_fd = sys_open("/dev/root", O_RDONLY, 0);
    + if (suspend_read_fd < 0)
    + goto out;
    +
    + sys_read(suspend_read_fd, suspend_writer_buffer, BLOCK_SIZE);
    +
    + memcpy(&suspend_writer_posn_save,
    + suspend_writer_buffer + suspend_writer_buffer_posn,
    + sizeof(suspend_writer_posn_save));
    +
    + suspend_writer_buffer_posn += sizeof(suspend_writer_posn_save);
    +
    + return 0;
    +out:
    + sys_unlink("/dev/ram");
    + sys_unlink("/dev/root");
    + return -EIO;
    +}
    +
    --
    Nigel Cunningham nigel at suspend2 dot net
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-06-27 01:04    [W:0.021 / U:3.824 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site