diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-16 21:29:08 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-16 21:29:08 +0000 |
commit | 62191e1a593efa46933eb89c13f7275b804f5885 (patch) | |
tree | 56d6a5818b871650e6340e10355945a874be046a /sbin/pdisk | |
parent | e1b775ce0aa8f703c9908974a92dcfa339a19c21 (diff) |
There can be only one. 'kind' that is. No need to allocate or track the
media kind since it will always be the same -- a file.
No functional change.
Diffstat (limited to 'sbin/pdisk')
-rw-r--r-- | sbin/pdisk/file_media.c | 20 | ||||
-rw-r--r-- | sbin/pdisk/media.c | 9 | ||||
-rw-r--r-- | sbin/pdisk/media.h | 4 |
3 files changed, 3 insertions, 30 deletions
diff --git a/sbin/pdisk/file_media.c b/sbin/pdisk/file_media.c index fe770827e46..56af45df610 100644 --- a/sbin/pdisk/file_media.c +++ b/sbin/pdisk/file_media.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file_media.c,v 1.22 2016/01/16 20:00:50 krw Exp $ */ +/* $OpenBSD: file_media.c,v 1.23 2016/01/16 21:29:07 krw Exp $ */ /* * file_media.c - @@ -63,10 +63,6 @@ struct file_media { int regular_file; }; -struct file_media_globals { - long exists; - long kind; -}; /* * Global Constants @@ -77,7 +73,6 @@ struct file_media_globals { * Global Variables */ static long file_inited = 0; -static struct file_media_globals file_info; /* * Forward declarations @@ -96,8 +91,6 @@ file_init(void) return; } file_inited = 1; - - file_info.kind = allocate_media_kind(); } @@ -145,7 +138,6 @@ open_file_as_media(char *file, int oflag) if (fd >= 0) { a = new_file_media(); if (a != 0) { - a->m.kind = file_info.kind; a->m.grain = compute_block_size(fd, file); off = lseek(fd, 0, SEEK_END); /* seek to end of media */ //printf("file size = %Ld\n", off); @@ -178,9 +170,6 @@ read_file_media(MEDIA m, long long offset, unsigned long count, void *address) if (a == 0) { /* no media */ fprintf(stderr,"no media\n"); - } else if (a->m.kind != file_info.kind) { - /* wrong kind - XXX need to error here - this is an internal problem */ - fprintf(stderr,"wrong kind\n"); } else if (count <= 0 || count % a->m.grain != 0) { /* can't handle size */ fprintf(stderr,"bad size\n"); @@ -222,8 +211,6 @@ write_file_media(MEDIA m, long long offset, unsigned long count, void *address) rtn_value = 0; if (a == 0) { /* no media */ - } else if (a->m.kind != file_info.kind) { - /* wrong kind - XXX need to error here - this is an internal problem */ } else if (count <= 0 || count % a->m.grain != 0) { /* can't handle size */ } else if (offset < 0 || offset % a->m.grain != 0) { @@ -254,9 +241,6 @@ close_file_media(MEDIA m) a = (FILE_MEDIA) m; if (a == 0) { return 0; - } else if (a->m.kind != file_info.kind) { - /* XXX need to error here - this is an internal problem */ - return 0; } close(a->fd); @@ -274,8 +258,6 @@ os_reload_file_media(MEDIA m) rtn_value = 0; if (a == 0) { /* no media */ - } else if (a->m.kind != file_info.kind) { - /* wrong kind - XXX need to error here - this is an internal problem */ } else if (a->regular_file) { /* okay - nothing to do */ rtn_value = 1; diff --git a/sbin/pdisk/media.c b/sbin/pdisk/media.c index 6e94ca2ccad..ad5ac647b46 100644 --- a/sbin/pdisk/media.c +++ b/sbin/pdisk/media.c @@ -1,4 +1,4 @@ -/* $OpenBSD: media.c,v 1.9 2016/01/16 20:00:50 krw Exp $ */ +/* $OpenBSD: media.c,v 1.10 2016/01/16 21:29:07 krw Exp $ */ /* * media.c - @@ -54,7 +54,6 @@ /* * Global Variables */ -static long media_kind = 0; /* * Forward declarations @@ -64,12 +63,6 @@ static long media_kind = 0; /* * Routines */ -long -allocate_media_kind(void) -{ - media_kind++; - return media_kind; -} MEDIA diff --git a/sbin/pdisk/media.h b/sbin/pdisk/media.h index 389904fb042..c5d7b8852f3 100644 --- a/sbin/pdisk/media.h +++ b/sbin/pdisk/media.h @@ -1,4 +1,4 @@ -/* $OpenBSD: media.h,v 1.8 2016/01/16 20:04:12 krw Exp $ */ +/* $OpenBSD: media.h,v 1.9 2016/01/16 21:29:07 krw Exp $ */ /* * media.h - @@ -62,7 +62,6 @@ typedef struct media *MEDIA; struct media { - long kind; /* kind of media - SCSI, IDE, etc. */ unsigned long grain; /* granularity (offset & size) */ long long size_in_bytes; /* offset granularity */ }; @@ -85,7 +84,6 @@ unsigned long media_granularity(MEDIA m); long long media_total_size(MEDIA m); /* those who define media objects need these routines also */ -long allocate_media_kind(void); MEDIA new_media(long size); void delete_media(MEDIA m); |