constants for tar header offsets

Поиск
Список
Период
Сортировка
От Robert Haas
Тема constants for tar header offsets
Дата
Msg-id CA+TgmoZNbLwhmCrNtkJAvi8FLkwFdMeVU3myV2HQQpA5bvbRZg@mail.gmail.com
обсуждение исходный текст
Ответы Re: constants for tar header offsets  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

We have a few different places in the code where we generate or modify
tar headers or just read data out of them. The code in question uses
one of my less-favorite programming things: magic numbers. The offsets
of the various fields within the tar header are just hard-coded in
each relevant place in our code. I think we should clean that up, as
in the attached patch.

I hasten to emphasize that, while I think this is an improvement, I
don't think the result is particularly awesome. Even with the patch,
src/port/tar.c and src/include/pgtar.h do a poor job insulating
callers from the details of the tar format. However, it's also not
very clear to me how to fix that. For instance, I thought about
writing a function that parses a tar header into a struct and then
using it in all of these places, but that seems like it would lose too
much efficiency relative to the current ad-hoc coding. So for now I
don't have a better idea than this.

--
Robert Haas
EDB: http://www.enterprisedb.com

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Temporary tables versus wraparound... again
Следующее
От: Robert Haas
Дата:
Сообщение: Re: allow_in_place_tablespaces vs. pg_basebackup