diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1995-10-13 08:19:45 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1995-10-13 08:19:45 +0000 |
| commit | 4f6f10295a8c9f33f37243083a74aa263b38a849 (patch) | |
| tree | 75de4f08808ba74df5bea9825063a2ecf4bda5be /lib/libdisk | |
| parent | 2602086362e7e951bd93b1c9110ea25f5773fe7c (diff) | |
Notes
Diffstat (limited to 'lib/libdisk')
| -rw-r--r-- | lib/libdisk/create_chunk.c | 42 | ||||
| -rw-r--r-- | lib/libdisk/libdisk.h | 7 |
2 files changed, 34 insertions, 15 deletions
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index a9688290e7ac..3f809ed15363 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: create_chunk.c,v 1.21 1995/06/11 19:29:33 rgrimes Exp $ + * $Id: create_chunk.c,v 1.21.2.1 1995/09/20 10:43:02 jkh Exp $ * */ @@ -238,7 +238,7 @@ MakeDev(struct chunk *c1, char *path) p++; if (isdigit(*p)) { unit *= 10; - unit = *p - '0'; + unit += (*p - '0'); p++; } if (!*p) { @@ -255,7 +255,7 @@ MakeDev(struct chunk *c1, char *path) p++; if (isdigit(*p)) { slice *= 10; - slice = *p - '0'; + slice += (*p - '0'); p++; } slice = slice+1; @@ -275,26 +275,42 @@ MakeDev(struct chunk *c1, char *path) return 0; min = unit * 8 + 65536 * slice + part; sprintf(buf,"%s/r%s",path,c1->name); - unlink(buf); mknod(buf,S_IFCHR|0640,makedev(cmaj,min)); - if(*buf2) { + unlink(buf); + if (mknod(buf,S_IFCHR|0640,makedev(cmaj,min)) == -1) { + perror("mknod"); + return 0; + } + if (*buf2) { sprintf(buf,"%s/r%s",path,buf2); - unlink(buf); mknod(buf,S_IFCHR|0640,makedev(cmaj,min)); + unlink(buf); + if (mknod(buf,S_IFCHR|0640,makedev(cmaj,min)) == -1) { + perror("mknod"); + return 0; + } } sprintf(buf,"%s/%s",path,c1->name); - unlink(buf); mknod(buf,S_IFBLK|0640,makedev(bmaj,min)); + unlink(buf); + if (mknod(buf, S_IFBLK|0640, makedev(bmaj,min)) == -1) { + perror("mknod"); + return 0; + } return 1; } -void +int MakeDevChunk(struct chunk *c1,char *path) { - MakeDev(c1,path); - if (c1->next) MakeDevChunk(c1->next,path); - if (c1->part) MakeDevChunk(c1->part,path); + int i = 1; + + if (!MakeDev(c1, path)) + return 0; + if (c1->next) i = MakeDevChunk(c1->next,path); + if (c1->part) i |= MakeDevChunk(c1->part, path); + return i; } -void +int MakeDevDisk(struct disk *d,char *path) { - MakeDevChunk(d->chunks,path); + return MakeDevChunk(d->chunks,path); } diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index 12c3a9a5d7c0..48326347180a 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: libdisk.h,v 1.19 1995/06/11 19:29:35 rgrimes Exp $ + * $Id: libdisk.h,v 1.19.2.1 1995/09/20 10:43:03 jkh Exp $ * */ @@ -217,7 +217,10 @@ Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, chunk_e ty * enough is used. */ -void +int +MakeDev(struct chunk *c, char *path); + +int MakeDevDisk(struct disk *d,char *path); /* Make device nodes for all chunks on this disk */ |
