Hi, On 2019-02-23 11:59:04 +1300, Thomas Munro wrote: > On Sat, Feb 23, 2019 at 11:48 AM Andres Freund <and...@anarazel.de> wrote: > > > Yeah I suggested dynamic registration to avoid the problem that eg > > > src/backend/storage/sync.c otherwise needs to forward declare > > > md_tagtopath(), undofile_tagtopath(), slru_tagtopath(), ..., or maybe > > > #include <storage/md.h> etc, which seemed like exactly the sort of > > > thing up with which you would not put. > > > > I'm not sure I understand. If we have a few known tag types, what's the > > problem with including the headers with knowledge of how to implement > > them into sync.c file? > > Typo in my previous email: src/backend/storage/file/sync.c was my > proposal for the translation unit holding this stuff (we don't have .c > files directly under storage). But it didn't seem right that stuff > under storage/file (things concerned with files) should know about > stuff under storage/smgr (md.c functions, higher level smgr stuff). > Perhaps that just means it should go into a different subdir, maybe > src/backend/storage/sync/sync.c, that knows about files AND smgr > stuff, or perhaps I'm worrying about nothing.
I mean, if you have a md_tagtopath and need its behaviour, I don't understand why a local forward declaration changes things? But I also think this is a bit of a non-problem - the abbreviated path names are just a different representation of paths, I don't see a problem of having that in sync.[ch], especially if we have the option to also have a full-length pathname variant if we ever need that. Greetings, Andres Freund