summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2016-10-03 01:46:47 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2016-10-03 01:46:47 +0000
commit1080fb197b61df4d185516c936937af4846fc2cb (patch)
treeb5ac18a8c298137ea974da7a2ce7c2e4676288d2
parent2abb9b42a53c39a8b781e25a05de1de9e98b8b9a (diff)
downloadsrc-test2-1080fb197b61df4d185516c936937af4846fc2cb.tar.gz
src-test2-1080fb197b61df4d185516c936937af4846fc2cb.zip
Notes
-rw-r--r--usr.bin/mkimg/apm.c2
-rw-r--r--usr.bin/mkimg/bsd.c2
-rw-r--r--usr.bin/mkimg/ebr.c3
-rw-r--r--usr.bin/mkimg/gpt.c2
-rw-r--r--usr.bin/mkimg/image.c26
-rw-r--r--usr.bin/mkimg/mbr.c2
-rw-r--r--usr.bin/mkimg/mkimg.c8
-rw-r--r--usr.bin/mkimg/mkimg.h4
-rw-r--r--usr.bin/mkimg/pc98.c2
-rw-r--r--usr.bin/mkimg/vtoc8.c2
10 files changed, 27 insertions, 26 deletions
diff --git a/usr.bin/mkimg/apm.c b/usr.bin/mkimg/apm.c
index 2948faeeeab5..14b60e25acc7 100644
--- a/usr.bin/mkimg/apm.c
+++ b/usr.bin/mkimg/apm.c
@@ -91,7 +91,7 @@ apm_write(lba_t imgsz, void *bootcode __unused)
strncpy(ent->ent_type, APM_ENT_TYPE_SELF, sizeof(ent->ent_type));
strncpy(ent->ent_name, "Apple", sizeof(ent->ent_name));
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
ent = (void *)(buf + (part->index + 2) * secsz);
be16enc(&ent->ent_sig, APM_ENT_SIG);
be32enc(&ent->ent_pmblkcnt, nparts + 1);
diff --git a/usr.bin/mkimg/bsd.c b/usr.bin/mkimg/bsd.c
index 2d52dd806d2e..95aa1aa8e9a4 100644
--- a/usr.bin/mkimg/bsd.c
+++ b/usr.bin/mkimg/bsd.c
@@ -103,7 +103,7 @@ bsd_write(lba_t imgsz, void *bootcode)
dp = &d->d_partitions[RAW_PART];
le32enc(&dp->p_size, imgsz);
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
n = part->index + ((part->index >= RAW_PART) ? 1 : 0);
dp = &d->d_partitions[n];
le32enc(&dp->p_size, part->size);
diff --git a/usr.bin/mkimg/ebr.c b/usr.bin/mkimg/ebr.c
index bbe9fa6c6990..d45e6eab6d09 100644
--- a/usr.bin/mkimg/ebr.c
+++ b/usr.bin/mkimg/ebr.c
@@ -88,7 +88,7 @@ ebr_write(lba_t imgsz __unused, void *bootcode __unused)
le16enc(ebr + DOSMAGICOFFSET, DOSMAGIC);
error = 0;
- STAILQ_FOREACH_SAFE(part, &partlist, link, next) {
+ TAILQ_FOREACH(part, &partlist, link) {
block = part->block - nsecs;
size = round_track(part->size);
dp = (void *)(ebr + DOSPARTOFF);
@@ -100,6 +100,7 @@ ebr_write(lba_t imgsz __unused, void *bootcode __unused)
le32enc(&dp->dp_size, size);
/* Add link entry */
+ next = TAILQ_NEXT(part, link);
if (next != NULL) {
size = round_track(next->size);
dp++;
diff --git a/usr.bin/mkimg/gpt.c b/usr.bin/mkimg/gpt.c
index d63c04ae93fe..c3a7e2916cf8 100644
--- a/usr.bin/mkimg/gpt.c
+++ b/usr.bin/mkimg/gpt.c
@@ -208,7 +208,7 @@ gpt_mktbl(u_int tblsz)
if (tbl == NULL)
return (NULL);
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
ent = tbl + part->index;
gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type));
mkimg_uuid(&uuid);
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c
index 3a2936c20131..becb4e9bef35 100644
--- a/usr.bin/mkimg/image.c
+++ b/usr.bin/mkimg/image.c
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
#endif
struct chunk {
- STAILQ_ENTRY(chunk) ch_list;
+ TAILQ_ENTRY(chunk) ch_list;
size_t ch_size; /* Size of chunk in bytes. */
lba_t ch_block; /* Block address in image. */
union {
@@ -78,7 +78,7 @@ struct chunk {
#define CH_TYPE_MEMORY 2 /* Memory-backed chunk */
};
-static STAILQ_HEAD(chunk_head, chunk) image_chunks;
+static TAILQ_HEAD(chunk_head, chunk) image_chunks;
static u_int image_nchunks;
static char image_swap_file[PATH_MAX];
@@ -139,14 +139,14 @@ image_chunk_find(lba_t blk)
struct chunk *ch;
ch = (last != NULL && last->ch_block <= blk)
- ? last : STAILQ_FIRST(&image_chunks);
+ ? last : TAILQ_FIRST(&image_chunks);
while (ch != NULL) {
if (ch->ch_block <= blk &&
(lba_t)(ch->ch_block + (ch->ch_size / secsz)) > blk) {
last = ch;
break;
}
- ch = STAILQ_NEXT(ch, ch_list);
+ ch = TAILQ_NEXT(ch, ch_list);
}
return (ch);
}
@@ -188,7 +188,7 @@ image_chunk_memory(struct chunk *ch, lba_t blk)
ch->ch_size = (blk - ch->ch_block) * secsz;
new->ch_block = blk;
new->ch_size -= ch->ch_size;
- STAILQ_INSERT_AFTER(&image_chunks, ch, new, ch_list);
+ TAILQ_INSERT_AFTER(&image_chunks, ch, new, ch_list);
image_nchunks++;
ch = new;
}
@@ -203,7 +203,7 @@ image_chunk_memory(struct chunk *ch, lba_t blk)
ch->ch_size = secsz;
new->ch_block++;
new->ch_size -= secsz;
- STAILQ_INSERT_AFTER(&image_chunks, ch, new, ch_list);
+ TAILQ_INSERT_AFTER(&image_chunks, ch, new, ch_list);
image_nchunks++;
}
@@ -219,7 +219,7 @@ image_chunk_skipto(lba_t to)
lba_t from;
size_t sz;
- ch = STAILQ_LAST(&image_chunks, chunk, ch_list);
+ ch = TAILQ_LAST(&image_chunks, chunk_head);
from = (ch != NULL) ? ch->ch_block + (ch->ch_size / secsz) : 0LL;
assert(from <= to);
@@ -244,7 +244,7 @@ image_chunk_skipto(lba_t to)
ch->ch_block = from;
ch->ch_size = sz;
ch->ch_type = CH_TYPE_ZEROES;
- STAILQ_INSERT_TAIL(&image_chunks, ch, ch_list);
+ TAILQ_INSERT_TAIL(&image_chunks, ch, ch_list);
image_nchunks++;
return (0);
}
@@ -254,7 +254,7 @@ image_chunk_append(lba_t blk, size_t sz, off_t ofs, int fd)
{
struct chunk *ch;
- ch = STAILQ_LAST(&image_chunks, chunk, ch_list);
+ ch = TAILQ_LAST(&image_chunks, chunk_head);
if (ch != NULL && ch->ch_type == CH_TYPE_FILE) {
if (fd == ch->ch_u.file.fd &&
blk == (lba_t)(ch->ch_block + (ch->ch_size / secsz)) &&
@@ -275,7 +275,7 @@ image_chunk_append(lba_t blk, size_t sz, off_t ofs, int fd)
ch->ch_type = CH_TYPE_FILE;
ch->ch_u.file.ofs = ofs;
ch->ch_u.file.fd = fd;
- STAILQ_INSERT_TAIL(&image_chunks, ch, ch_list);
+ TAILQ_INSERT_TAIL(&image_chunks, ch, ch_list);
image_nchunks++;
return (0);
}
@@ -698,7 +698,7 @@ image_cleanup(void)
{
struct chunk *ch;
- while ((ch = STAILQ_FIRST(&image_chunks)) != NULL) {
+ while ((ch = TAILQ_FIRST(&image_chunks)) != NULL) {
switch (ch->ch_type) {
case CH_TYPE_FILE:
/* We may be closing the same file multiple times. */
@@ -711,7 +711,7 @@ image_cleanup(void)
default:
break;
}
- STAILQ_REMOVE_HEAD(&image_chunks, ch_list);
+ TAILQ_REMOVE(&image_chunks, ch, ch_list);
free(ch);
}
if (image_swap_fd != -1)
@@ -724,7 +724,7 @@ image_init(void)
{
const char *tmpdir;
- STAILQ_INIT(&image_chunks);
+ TAILQ_INIT(&image_chunks);
image_nchunks = 0;
image_swap_size = 0;
diff --git a/usr.bin/mkimg/mbr.c b/usr.bin/mkimg/mbr.c
index 72e67ad2727f..81dfebf5a705 100644
--- a/usr.bin/mkimg/mbr.c
+++ b/usr.bin/mkimg/mbr.c
@@ -101,7 +101,7 @@ mbr_write(lba_t imgsz __unused, void *bootcode)
memset(mbr, 0, secsz);
le16enc(mbr + DOSMAGICOFFSET, DOSMAGIC);
dpbase = (void *)(mbr + DOSPARTOFF);
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
size = round_track(part->size);
dp = dpbase + part->index;
dp->dp_flag = (part->index == 0 && bootcode != NULL) ? 0x80 : 0;
diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c
index 3dfc10a3617d..84f2e83a2c30 100644
--- a/usr.bin/mkimg/mkimg.c
+++ b/usr.bin/mkimg/mkimg.c
@@ -61,7 +61,7 @@ static struct option longopts[] = {
static uint64_t capacity;
-struct partlisthead partlist = STAILQ_HEAD_INITIALIZER(partlist);
+struct partlisthead partlist = TAILQ_HEAD_INITIALIZER(partlist);
u_int nparts = 0;
u_int unit_testing;
@@ -301,7 +301,7 @@ parse_part(const char *spec)
}
part->index = nparts;
- STAILQ_INSERT_TAIL(&partlist, part, link);
+ TAILQ_INSERT_TAIL(&partlist, part, link);
nparts++;
return (0);
@@ -412,14 +412,14 @@ mkimg(void)
int error, fd;
/* First check partition information */
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
error = scheme_check_part(part);
if (error)
errc(EX_DATAERR, error, "partition %d", part->index+1);
}
block = scheme_metadata(SCHEME_META_IMG_START, 0);
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
block = scheme_metadata(SCHEME_META_PART_BEFORE, block);
if (verbose)
fprintf(stderr, "partition %d: starting block %llu "
diff --git a/usr.bin/mkimg/mkimg.h b/usr.bin/mkimg/mkimg.h
index 281beebc9dcb..5a0b4dfefc51 100644
--- a/usr.bin/mkimg/mkimg.h
+++ b/usr.bin/mkimg/mkimg.h
@@ -32,7 +32,7 @@
#include <sys/queue.h>
struct part {
- STAILQ_ENTRY(part) link;
+ TAILQ_ENTRY(part) link;
char *alias; /* Partition type alias. */
char *contents; /* Contents/size specification. */
u_int kind; /* Content kind. */
@@ -47,7 +47,7 @@ struct part {
char *label; /* Partition label. */
};
-extern STAILQ_HEAD(partlisthead, part) partlist;
+extern TAILQ_HEAD(partlisthead, part) partlist;
extern u_int nparts;
extern u_int unit_testing;
diff --git a/usr.bin/mkimg/pc98.c b/usr.bin/mkimg/pc98.c
index 979d1b4dc934..09f90b600659 100644
--- a/usr.bin/mkimg/pc98.c
+++ b/usr.bin/mkimg/pc98.c
@@ -97,7 +97,7 @@ pc98_write(lba_t imgsz __unused, void *bootcode)
memset(buf, 0, PC98_BOOTCODESZ);
le16enc(buf + PC98_MAGICOFS, PC98_MAGIC);
dpbase = (void *)(buf + secsz);
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
size = round_track(part->size);
dp = dpbase + part->index;
ptyp = ALIAS_TYPE2INT(part->type);
diff --git a/usr.bin/mkimg/vtoc8.c b/usr.bin/mkimg/vtoc8.c
index dfb499dedf39..11295a903bc1 100644
--- a/usr.bin/mkimg/vtoc8.c
+++ b/usr.bin/mkimg/vtoc8.c
@@ -87,7 +87,7 @@ vtoc8_write(lba_t imgsz, void *bootcode __unused)
be16enc(&vtoc8.magic, VTOC_MAGIC);
be32enc(&vtoc8.map[VTOC_RAW_PART].nblks, imgsz);
- STAILQ_FOREACH(part, &partlist, link) {
+ TAILQ_FOREACH(part, &partlist, link) {
n = part->index + ((part->index >= VTOC_RAW_PART) ? 1 : 0);
be16enc(&vtoc8.part[n].tag, ALIAS_TYPE2INT(part->type));
be32enc(&vtoc8.map[n].cyl, part->block / (nsecs * nheads));