summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-01-17 18:57:53 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-01-17 18:57:53 +0000
commit5db06af4f824eff841d51c1fc857f885f1ebaa43 (patch)
treeadb7caffb8e5c5bba951a39d2973a18e914bc050
parent35d519c17bd4c899ae1d231dd0d92bce0c817cf9 (diff)
Remove a bunch of ridiculous and uninformative comments like "// Defines".
-rw-r--r--sbin/pdisk/convert.c30
-rw-r--r--sbin/pdisk/convert.h26
-rw-r--r--sbin/pdisk/dpme.h26
-rw-r--r--sbin/pdisk/dump.c9
-rw-r--r--sbin/pdisk/dump.h26
-rw-r--r--sbin/pdisk/file_media.c28
-rw-r--r--sbin/pdisk/file_media.h25
-rw-r--r--sbin/pdisk/io.c33
-rw-r--r--sbin/pdisk/io.h23
-rw-r--r--sbin/pdisk/partition_map.c30
-rw-r--r--sbin/pdisk/partition_map.h23
-rw-r--r--sbin/pdisk/pdisk.c32
-rw-r--r--sbin/pdisk/validate.c32
-rw-r--r--sbin/pdisk/validate.h26
14 files changed, 14 insertions, 355 deletions
diff --git a/sbin/pdisk/convert.c b/sbin/pdisk/convert.c
index 4881c97399d..d42ac16fd62 100644
--- a/sbin/pdisk/convert.c
+++ b/sbin/pdisk/convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: convert.c,v 1.14 2016/01/17 18:26:51 krw Exp $ */
+/* $OpenBSD: convert.c,v 1.15 2016/01/17 18:57:52 krw Exp $ */
//
// convert.c - Little-endian conversion
@@ -34,37 +34,9 @@
#include "convert.h"
-
-//
-// Defines
-//
-
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
-
-
-//
-// Global Variables
-//
-
-
-//
-// Forward declarations
-//
void reverse2(uint8_t *bytes);
void reverse4(uint8_t *bytes);
-
-//
-// Routines
-//
int
convert_dpme(struct dpme *data, int to_cpu_form)
{
diff --git a/sbin/pdisk/convert.h b/sbin/pdisk/convert.h
index 08c7d5336de..73f5546b292 100644
--- a/sbin/pdisk/convert.h
+++ b/sbin/pdisk/convert.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: convert.h,v 1.7 2016/01/17 16:15:59 krw Exp $ */
+/* $OpenBSD: convert.h,v 1.8 2016/01/17 18:57:52 krw Exp $ */
//
// convert.h - Little-endian conversion
@@ -36,30 +36,6 @@
#include "dpme.h"
-
-//
-// Defines
-//
-
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
-
-
-//
-// Global Variables
-//
-
-
-//
-// Forward declarations
-//
int convert_block0(struct block0 *data, int to_cpu_form);
int convert_dpme(struct dpme *data, int to_cpu_form);
diff --git a/sbin/pdisk/dpme.h b/sbin/pdisk/dpme.h
index ee1ff731003..ee916ebb145 100644
--- a/sbin/pdisk/dpme.h
+++ b/sbin/pdisk/dpme.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dpme.h,v 1.13 2016/01/17 18:44:59 krw Exp $ */
+/* $OpenBSD: dpme.h,v 1.14 2016/01/17 18:57:52 krw Exp $ */
//
// dpme.h - Disk Partition Map Entry (dpme)
@@ -42,20 +42,11 @@
#ifndef __dpme__
#define __dpme__
-//
-// Defines
-//
#define BLOCK0_SIGNATURE 0x4552 /* i.e. 'ER' */
#define DPISTRLEN 32
#define DPME_SIGNATURE 0x504D /* i.e. 'PM' */
-//
-// Types
-//
-
-
-// Physical block zero of the disk has this format
struct block0 {
uint16_t sbSig; /* unique value for SCSI block 0 */
uint16_t sbBlkSize; /* block size of device */
@@ -111,19 +102,4 @@ struct dpme {
uint32_t dpme_reserved_3[62] ;
};
-
-//
-// Global Constants
-//
-
-
-//
-// Global Variables
-//
-
-
-//
-// Forward declarations
-//
-
#endif /* __dpme__ */
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c
index 057813b1b00..c1bebeecdb7 100644
--- a/sbin/pdisk/dump.c
+++ b/sbin/pdisk/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.30 2016/01/17 18:44:59 krw Exp $ */
+/* $OpenBSD: dump.c,v 1.31 2016/01/17 18:57:52 krw Exp $ */
//
// dump.c - dumping partition maps
@@ -31,17 +31,10 @@
#include <err.h>
-// for *printf()
#include <stdio.h>
-
-// for malloc() & free()
#include <stdlib.h>
-
-// for strcmp()
#include <string.h>
-// for O_RDONLY
#include <fcntl.h>
-// for errno
#include <errno.h>
#include "file_media.h"
diff --git a/sbin/pdisk/dump.h b/sbin/pdisk/dump.h
index 9c3fde00c4e..ca0d1217b8d 100644
--- a/sbin/pdisk/dump.h
+++ b/sbin/pdisk/dump.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.h,v 1.7 2016/01/17 17:44:05 krw Exp $ */
+/* $OpenBSD: dump.h,v 1.8 2016/01/17 18:57:52 krw Exp $ */
//
// dump.h - dumping partition maps
@@ -32,30 +32,6 @@
#include "partition_map.h"
-
-//
-// Defines
-//
-
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
-
-
-//
-// Global Variables
-//
-
-
-//
-// Forward declarations
-//
void display_patches(struct partition_map *entry);
int dump(char *name);
void dump_block(unsigned char *addr, int len);
diff --git a/sbin/pdisk/file_media.c b/sbin/pdisk/file_media.c
index 763f9df544e..1800711eb28 100644
--- a/sbin/pdisk/file_media.c
+++ b/sbin/pdisk/file_media.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file_media.c,v 1.27 2016/01/17 15:57:12 krw Exp $ */
+/* $OpenBSD: file_media.c,v 1.28 2016/01/17 18:57:52 krw Exp $ */
/*
* file_media.c -
@@ -32,17 +32,11 @@
#include <sys/disklabel.h>
#include <err.h>
-// for printf()
#include <stdio.h>
-// for malloc() & free()
#include <stdlib.h>
-// for lseek(), read(), write(), close()
#include <unistd.h>
-// for open()
#include <fcntl.h>
-// for LONG_MAX
#include <limits.h>
-// for errno
#include <errno.h>
#include <sys/ioctl.h>
@@ -51,31 +45,11 @@
#include "file_media.h"
-
-/*
- * Types
- */
-
-
-/*
- * Global Constants
- */
-
-
-/*
- * Global Variables
- */
static long file_inited = 0;
-/*
- * Forward declarations
- */
void compute_block_size(int fd, char *name);
void file_init(void);
-/*
- * Routines
- */
void
file_init(void)
{
diff --git a/sbin/pdisk/file_media.h b/sbin/pdisk/file_media.h
index d37c91f3ada..ee2cfd40d36 100644
--- a/sbin/pdisk/file_media.h
+++ b/sbin/pdisk/file_media.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file_media.h,v 1.8 2016/01/17 15:57:12 krw Exp $ */
+/* $OpenBSD: file_media.h,v 1.9 2016/01/17 18:57:52 krw Exp $ */
/*
* file_media.h -
@@ -31,35 +31,12 @@
#define __file_media__
-/*
- * Defines
- */
-
-
-/*
- * Types
- */
-
struct file_media {
long long size_in_bytes; /* offset granularity */
int fd;
int regular_file;
};
-
-/*
- * Global Constants
- */
-
-
-/*
- * Global Variables
- */
-
-
-/*
- * Forward declarations
- */
struct file_media *open_file_as_media(char *file, int oflag);
long read_file_media(struct file_media *m, long long offset, unsigned long count, void *address);
long write_file_media(struct file_media *m, long long offset, unsigned long count, void *address);
diff --git a/sbin/pdisk/io.c b/sbin/pdisk/io.c
index 4aef0a0dc95..cb331218e51 100644
--- a/sbin/pdisk/io.c
+++ b/sbin/pdisk/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.12 2016/01/12 23:48:42 krw Exp $ */
+/* $OpenBSD: io.c,v 1.13 2016/01/17 18:57:52 krw Exp $ */
//
// io.c - simple io and input parsing routines
@@ -29,60 +29,29 @@
#include <err.h>
-// for *printf()
#include <stdio.h>
-
-// for malloc() & free()
#include <stdlib.h>
-// for strncpy()
#include <string.h>
-// for va_start(), etc.
#include <stdarg.h>
-// for errno
#include <errno.h>
#include "io.h"
-
-//
-// Defines
-//
#define BAD_DIGIT 17 /* must be greater than any base */
#define STRING_CHUNK 16
#define UNGET_MAX_COUNT 10
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
const long kDefault = -1;
-
-//
-// Global Variables
-//
short unget_buf[UNGET_MAX_COUNT+1];
int unget_count;
char io_buffer[MAXIOSIZE];
-
-//
-// Forward declarations
-//
long get_number(int first_char);
char* get_string(int eos);
int my_getch(void);
void my_ungetch(int c);
-
-//
-// Routines
-//
int
my_getch()
{
diff --git a/sbin/pdisk/io.h b/sbin/pdisk/io.h
index 6393f93265a..cb8b9012ec0 100644
--- a/sbin/pdisk/io.h
+++ b/sbin/pdisk/io.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.h,v 1.4 2016/01/11 07:54:07 jasper Exp $ */
+/* $OpenBSD: io.h,v 1.5 2016/01/17 18:57:52 krw Exp $ */
//
// io.h - simple io and input parsing routines
@@ -31,31 +31,10 @@
#define __io__
-//
-// Defines
-//
#define MAXIOSIZE 2048
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
extern const long kDefault;
-
-//
-// Global Variables
-//
-
-
-//
-// Forward declarations
-//
void bad_input(const char *fmt, ...);
void flush_to_newline(int keep_newline);
int get_command(const char *prompt, int promptBeforeGet, int *command);
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c
index b1e8e4d86c8..f40f809c713 100644
--- a/sbin/pdisk/partition_map.c
+++ b/sbin/pdisk/partition_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: partition_map.c,v 1.32 2016/01/17 18:44:59 krw Exp $ */
+/* $OpenBSD: partition_map.c,v 1.33 2016/01/17 18:57:52 krw Exp $ */
//
// partition_map.c - partition map routines
@@ -38,17 +38,10 @@
#include <unistd.h>
#include <util.h>
-// for *printf()
#include <stdio.h>
-
-// for malloc(), calloc() & free()
#include <stdlib.h>
-
-// for strncpy() & strcmp()
#include <string.h>
-// for O_RDONLY & O_RDWR
#include <fcntl.h>
-// for errno
#include <errno.h>
#include "partition_map.h"
@@ -56,24 +49,10 @@
#include "convert.h"
#include "file_media.h"
-
-//
-// Defines
-//
#define APPLE_HFS_FLAGS_VALUE 0x4000037f
#define get_align_long(x) (*(x))
#define put_align_long(y, x) ((*(x)) = (y))
-// #define TEST_COMPUTE
-
-
-//
-// Types
-//
-
-//
-// Global Constants
-//
const char * kFreeType = "Apple_Free";
const char * kMapType = "Apple_partition_map";
const char * kUnixType = "OpenBSD";
@@ -88,9 +67,6 @@ enum add_action {
kSplit = 2
};
-//
-// Forward declarations
-//
int add_data_to_map(struct dpme *, long, struct partition_map_header *);
int coerce_block0(struct partition_map_header *map);
int contains_driver(struct partition_map *entry);
@@ -108,10 +84,6 @@ void renumber_disk_addresses(struct partition_map_header *map);
void sync_device_size(struct partition_map_header *map);
int write_block(struct partition_map_header *map, unsigned long num, char *buf);
-
-//
-// Routines
-//
struct partition_map_header *
open_partition_map(char *name, int *valid_file)
{
diff --git a/sbin/pdisk/partition_map.h b/sbin/pdisk/partition_map.h
index acca0c46897..2b470ebd5b8 100644
--- a/sbin/pdisk/partition_map.h
+++ b/sbin/pdisk/partition_map.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: partition_map.h,v 1.14 2016/01/17 18:44:59 krw Exp $ */
+/* $OpenBSD: partition_map.h,v 1.15 2016/01/17 18:57:52 krw Exp $ */
//
// partition_map.h - partition map routines
@@ -33,15 +33,6 @@
#include "dpme.h"
#include "file_media.h"
-
-//
-// Defines
-//
-
-
-//
-// Types
-//
struct partition_map_header {
struct file_media *m;
char *name;
@@ -78,10 +69,6 @@ enum {
kHFS_plus = 3 // '+'
};
-
-//
-// Global Constants
-//
extern const char * kFreeType;
extern const char * kMapType;
extern const char * kUnixType;
@@ -89,17 +76,9 @@ extern const char * kHFSType;
extern const char * kFreeName;
extern const char * kPatchType;
-
-//
-// Global Variables
-//
extern int rflag;
extern int dflag;
-
-//
-// Forward declarations
-//
int add_partition_to_map(const char *name, const char *dptype, uint32_t base, uint32_t length, struct partition_map_header *map);
void close_partition_map(struct partition_map_header *map);
struct partition_map_header* create_partition_map(char *name, struct partition_map_header *oldmap);
diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c
index febfdc5e9fc..f4cc2efd6cf 100644
--- a/sbin/pdisk/pdisk.c
+++ b/sbin/pdisk/pdisk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdisk.c,v 1.40 2016/01/17 17:44:05 krw Exp $ */
+/* $OpenBSD: pdisk.c,v 1.41 2016/01/17 18:57:52 krw Exp $ */
//
// pdisk - an editor for Apple format partition tables
@@ -32,18 +32,11 @@
#include <sys/param.h> /* DEV_BSIZE */
#include <err.h>
-// for printf()
#include <stdio.h>
-
-// for malloc() & free()
#include <stdlib.h>
#include <unistd.h>
-
-// for strncpy() & strlen()
#include <string.h>
-// for O_RDONLY
#include <fcntl.h>
-// for errno
#include <errno.h>
#include "io.h"
@@ -52,24 +45,11 @@
#include "validate.h"
#include "file_media.h"
-
-//
-// Defines
-//
#define ARGV_CHUNK 5
#define DFLAG_DEFAULT 0
#define LFLAG_DEFAULT 0
#define RFLAG_DEFAULT 0
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
enum getopt_values {
kLongOption = 0,
kBadOption = '?',
@@ -79,19 +59,12 @@ enum getopt_values {
};
-//
-// Global Variables
-//
int lflag = LFLAG_DEFAULT; /* list the device */
int dflag = DFLAG_DEFAULT; /* turn on debugging commands and printout */
int rflag = RFLAG_DEFAULT; /* open device read Only */
static int first_get = 1;
-
-//
-// Forward declarations
-//
void do_change_map_size(struct partition_map_header *map);
void do_create_partition(struct partition_map_header *map, int get_type);
void do_delete_partition(struct partition_map_header *map);
@@ -113,9 +86,6 @@ void print_expert_notes(void);
__dead static void usage(void);
-//
-// Routines
-//
int
main(int argc, char **argv)
{
diff --git a/sbin/pdisk/validate.c b/sbin/pdisk/validate.c
index 0156da48905..c38863ea1b6 100644
--- a/sbin/pdisk/validate.c
+++ b/sbin/pdisk/validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: validate.c,v 1.21 2016/01/17 18:44:59 krw Exp $ */
+/* $OpenBSD: validate.c,v 1.22 2016/01/17 18:57:52 krw Exp $ */
//
// validate.c -
@@ -32,13 +32,9 @@
#include <err.h>
-// for *printf()
#include <stdio.h>
-// for malloc(), free()
#include <stdlib.h>
-// for O_RDONLY
#include <fcntl.h>
-// for errno
#include <errno.h>
#include "validate.h"
@@ -46,15 +42,6 @@
#include "io.h"
#include "file_media.h"
-
-//
-// Defines
-//
-
-
-//
-// Types
-//
enum range_state {
kUnallocated,
kAllocated,
@@ -70,15 +57,6 @@ struct range_list {
uint32_t end;
};
-
-//
-// Global Constants
-//
-
-
-//
-// Global Variables
-//
static char *buffer;
static struct block0 *b0;
static struct dpme *mb;
@@ -86,10 +64,6 @@ static struct partition_map_header *the_map;
static struct file_media *the_media;
static int g;
-
-//
-// Forward declarations
-//
int get_block_zero(void);
int get_block_n(int n);
struct range_list *new_range_list_item(enum range_state state, int valid, uint32_t low, uint32_t high);
@@ -98,10 +72,6 @@ void add_range(struct range_list **list, uint32_t base, uint32_t len, int alloca
void print_range_list(struct range_list *list);
void coalesce_list(struct range_list *list);
-
-//
-// Routines
-//
int
get_block_zero(void)
{
diff --git a/sbin/pdisk/validate.h b/sbin/pdisk/validate.h
index 94017e361e8..5c8ac8f19bb 100644
--- a/sbin/pdisk/validate.h
+++ b/sbin/pdisk/validate.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: validate.h,v 1.5 2016/01/17 17:44:05 krw Exp $ */
+/* $OpenBSD: validate.h,v 1.6 2016/01/17 18:57:52 krw Exp $ */
//
// validate.h -
@@ -32,30 +32,6 @@
#include "partition_map.h"
-
-//
-// Defines
-//
-
-
-//
-// Types
-//
-
-
-//
-// Global Constants
-//
-
-
-//
-// Global Variables
-//
-
-
-//
-// Forward declarations
-//
void validate_map(struct partition_map_header *map);
#endif /* __validate__ */