From 551c80c1c16545b0daaac74d770e5bedf1ad4f0a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 16 Jun 2008 15:36:40 -0700 Subject: [PATCH] imsm: implement store_zero_imsm and init_zero_imsm Signed-off-by: Dan Williams --- super-intel.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/super-intel.c b/super-intel.c index 77892dd2..c8419f00 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1031,8 +1031,7 @@ static int init_zero_imsm(struct supertype *st, mdu_array_info_t *info, unsigned long long size, char *name, char *homehost, int *uuid) { - printf("%s\n", __FUNCTION__); - + st->sb = NULL; return 0; } @@ -1269,7 +1268,18 @@ static int write_init_super_imsm(struct supertype *st) static int store_zero_imsm(struct supertype *st, int fd) { - printf("%s\n", __FUNCTION__); + unsigned long long dsize; + char buf[512]; + + get_dev_size(fd, NULL, &dsize); + + /* first block is stored on second to last sector of the disk */ + if (lseek64(fd, dsize - (512 * 2), SEEK_SET) < 0) + return 1; + + memset(buf, 0, sizeof(buf)); + if (write(fd, buf, sizeof(buf)) != sizeof(buf)) + return 1; return 0; } -- 2.47.2