diff options
author | Adam Jackson <ajax@redhat.com> | 2017-04-24 17:35:14 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-11-06 18:51:22 -0500 |
commit | fedc90e8e3f6c36204de5562bfb726270064a4f1 (patch) | |
tree | 42f3afff4468216ffe8dad7d2ae7bbaeb57216bb | |
parent | 47eceb44ca00569b76e4304ee3b36c8f87d46a3e (diff) |
xfs: port to libXfont2
This appears to work, in the sense that xfsinfo and fslsfonts print the
same thing before and after.
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | difs/atom.c | 2 | ||||
-rw-r--r-- | difs/charinfo.c | 70 | ||||
-rw-r--r-- | difs/difsutils.c | 12 | ||||
-rw-r--r-- | difs/fontinfo.c | 3 | ||||
-rw-r--r-- | difs/fonts.c | 76 | ||||
-rw-r--r-- | difs/initfonts.c | 45 | ||||
-rw-r--r-- | include/difs.h | 8 | ||||
-rw-r--r-- | include/difsutils.h | 8 | ||||
-rw-r--r-- | include/globals.h | 4 | ||||
-rw-r--r-- | include/misc.h | 12 | ||||
-rw-r--r-- | include/os.h | 2 | ||||
-rw-r--r-- | os/config.c | 5 | ||||
-rw-r--r-- | os/utils.c | 85 | ||||
-rw-r--r-- | os/xfstrans.c | 8 |
15 files changed, 252 insertions, 92 deletions
diff --git a/configure.ac b/configure.ac index 7b89bf6..4cc14a5 100644 --- a/configure.ac +++ b/configure.ac @@ -129,8 +129,8 @@ AC_CHECK_FUNCS([daemon]) # Checks for pkg-config packages # - xproto >= 7.0.17 required for _X_NORETURN in <X11/Xfuncproto.h> -# - xfont >= 1.4.5 required for matching MakeAtom prototypes in fontmisc.h -PKG_CHECK_MODULES(XFS, xproto >= 7.0.17 xfont >= 1.4.5 xtrans) +# - xfont >= 2.0.1 for new server API +PKG_CHECK_MODULES(XFS, xproto >= 7.0.17 xfont2 >= 2.0.1 xtrans) case "$host_os" in cygwin*|mingw*) diff --git a/difs/atom.c b/difs/atom.c index 00e05a5..b8c2713 100644 --- a/difs/atom.c +++ b/difs/atom.c @@ -148,7 +148,7 @@ ValidAtom(Atom atom) return (atom != None) && (atom <= lastAtom); } -char * +const char * NameForAtom(Atom atom) { NodePtr node; diff --git a/difs/charinfo.c b/difs/charinfo.c index 6a05082..f587017 100644 --- a/difs/charinfo.c +++ b/difs/charinfo.c @@ -54,11 +54,6 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xos.h> #include "misc.h" #include <X11/fonts/fontstruct.h> -#include <X11/fonts/fontutil.h> - -/* Don't conflict with macros/prototypes in difsutils.h */ -#define _HAVE_XALLOC_DECLS -#include <X11/fonts/fontmisc.h> #include "clientstr.h" #define FSMD_H @@ -250,6 +245,71 @@ GetExtents( } static int +CheckFSFormat(fsBitmapFormat format, + fsBitmapFormatMask fmask, + int *bit_order, + int *byte_order, + int *scan, + int *glyph, + int *image) +{ + /* convert format to what the low levels want */ + if (fmask & BitmapFormatMaskBit) { + *bit_order = format & BitmapFormatBitOrderMask; + *bit_order = (*bit_order == BitmapFormatBitOrderMSB) + ? MSBFirst : LSBFirst; + } + if (fmask & BitmapFormatMaskByte) { + *byte_order = format & BitmapFormatByteOrderMask; + *byte_order = (*byte_order == BitmapFormatByteOrderMSB) + ? MSBFirst : LSBFirst; + } + if (fmask & BitmapFormatMaskScanLineUnit) { + *scan = format & BitmapFormatScanlineUnitMask; + /* convert byte paddings into byte counts */ + switch (*scan) { + case BitmapFormatScanlineUnit8: + *scan = 1; + break; + case BitmapFormatScanlineUnit16: + *scan = 2; + break; + case BitmapFormatScanlineUnit32: + *scan = 4; + break; + default: + return BadFontFormat; + } + } + if (fmask & BitmapFormatMaskScanLinePad) { + *glyph = format & BitmapFormatScanlinePadMask; + /* convert byte paddings into byte counts */ + switch (*glyph) { + case BitmapFormatScanlinePad8: + *glyph = 1; + break; + case BitmapFormatScanlinePad16: + *glyph = 2; + break; + case BitmapFormatScanlinePad32: + *glyph = 4; + break; + default: + return BadFontFormat; + } + } + if (fmask & BitmapFormatMaskImageRectangle) { + *image = format & BitmapFormatImageRectMask; + + if (*image != BitmapFormatImageRectMin && + *image != BitmapFormatImageRectMaxWidth && + *image != BitmapFormatImageRectMax) + return BadFontFormat; + } + return Successful; +} + +static int packGlyphs ( ClientPtr client, FontPtr pfont, diff --git a/difs/difsutils.c b/difs/difsutils.c index 0aef29a..2088730 100644 --- a/difs/difsutils.c +++ b/difs/difsutils.c @@ -227,7 +227,7 @@ NoopDDA(void) /* block & wakeup handlers */ typedef struct _BlockHandler { - BlockHandlerProcPtr BlockHandler; + FontBlockHandlerProcPtr BlockHandler; DifsWakeupFunc WakeupHandler; pointer blockData; Bool deleted; @@ -252,8 +252,7 @@ BlockHandler( ++inHandler; for (i = 0; i < numHandlers; i++) - (*handlers[i].BlockHandler) (handlers[i].blockData, - pTimeout, pReadmask); + (*handlers[i].BlockHandler) (handlers[i].blockData); if (handlerDeleted) { for (i = 0; i < numHandlers;) if (handlers[i].deleted) { @@ -297,7 +296,7 @@ WakeupHandler( Bool RegisterBlockAndWakeupHandlers( - BlockHandlerProcPtr blockHandler, + FontBlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData) { @@ -320,7 +319,7 @@ RegisterBlockAndWakeupHandlers( void RemoveBlockAndWakeupHandlers( - BlockHandlerProcPtr blockHandler, + FontBlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData) { @@ -527,8 +526,9 @@ Xcalloc(unsigned long n) } int -set_font_authorizations(char **authorizations, int *authlen, ClientPtr client) +set_font_authorizations(char **authorizations, int *authlen, void *_client) { + ClientPtr client = _client; #define AUTH1_NAME "hp-hostname-1" #define AUTH2_NAME "hp-printername-1" static char result[1024]; diff --git a/difs/fontinfo.c b/difs/fontinfo.c index e950ae8..19ecb4f 100644 --- a/difs/fontinfo.c +++ b/difs/fontinfo.c @@ -58,6 +58,7 @@ in this Software without prior written authorization from The Open Group. #include "closestr.h" #include "globals.h" #include "difs.h" +#include "misc.h" #include "dispatch.h" #include <swapreq.h> #include <swaprep.h> @@ -82,7 +83,7 @@ convert_props( { int i; int data_len, cur_off; - char *str; + const char *str; pointer ptr, off_ptr, string_base; fsPropOffset local_offset; diff --git a/difs/fonts.c b/difs/fonts.c index 08d8a93..fdb923a 100644 --- a/difs/fonts.c +++ b/difs/fonts.c @@ -63,10 +63,11 @@ in this Software without prior written authorization from The Open Group. #include "difs.h" #include "dispatch.h" #include "swaprep.h" +#include <X11/fonts/libxfont2.h> static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; static int num_fpes = 0; -static FPEFunctions *fpe_functions = (FPEFunctions *) 0; +static xfont2_fpe_funcs_rec *fpe_functions; static int num_fpe_types = 0; static int num_slept_fpes = 0; @@ -179,7 +180,7 @@ FontWakeup(pointer data, int count, unsigned long *lastSelectMask) /* wake up any fpe's that may be waiting for information */ for (i = 0; i < num_slept_fpes; i++) { fpe = slept_fpes[i]; - (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, lastSelectMask); + (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe); } } @@ -342,7 +343,8 @@ do_open_font(ClientPtr client, pointer data) cfp->clientindex = cPtr->client->index; if (fontPatternCache && pfont != cPtr->non_cachable_font) - CacheFontPattern(fontPatternCache, cPtr->orig_name, cPtr->orig_len, pfont); + xfont2_cache_font_pattern(fontPatternCache, cPtr->orig_name, + cPtr->orig_len, pfont); /* either pull out the other id or make the array */ if (pfont->refcnt != 0) { @@ -459,7 +461,8 @@ OpenFont( */ if (fontPatternCache && - (pfont = FindCachedFontPattern(fontPatternCache, name, namelen)) && + (pfont = xfont2_find_cached_font_pattern(fontPatternCache, name, + namelen)) && pfont->info.cachable) { ClientFontPtr cfp; @@ -550,7 +553,7 @@ close_font(FontPtr pfont) assert(pfont); if (--pfont->refcnt == 0) { if (fontPatternCache) - RemoveCachedFontPattern(fontPatternCache, pfont); + xfont2_remove_cached_font_pattern(fontPatternCache, pfont); fpe = pfont->fpe; free_svrPrivate(pfont->svrPrivate); (*fpe_functions[fpe->type].close_font) (fpe, pfont); @@ -726,7 +729,7 @@ set_font_path_elements( font_path_elements = fplist; num_fpes = npaths; if (fontPatternCache) - EmptyFontPatternCache(fontPatternCache); + xfont2_empty_font_pattern_cache(fontPatternCache); return FSSuccess; bail: *bad = validpaths; @@ -877,11 +880,11 @@ do_list_fonts_and_aliases(ClientPtr client, pointer data) if (cPtr->haveSaved) { if (cPtr->savedName) - (void)AddFontNamesName(cPtr->names, cPtr->savedName, - cPtr->savedNameLen); + xfont2_add_font_names_name(cPtr->names, cPtr->savedName, + cPtr->savedNameLen); } else - (void)AddFontNamesName(cPtr->names, name, namelen); + xfont2_add_font_names_name(cPtr->names, name, namelen); } /* @@ -1032,7 +1035,7 @@ bail: FreeFPE(cPtr->fpe_list[i]); fsfree(cPtr->fpe_list); if (cPtr->savedName) fsfree(cPtr->savedName); - FreeFontNames(names); + xfont2_free_font_names(names); fsfree(cPtr); return TRUE; } @@ -1066,7 +1069,7 @@ ListFonts( fsfree(c); goto badAlloc; } - c->names = MakeFontNamesRecord(maxNames < 100 ? maxNames : 100); + c->names = xfont2_make_font_names_record(maxNames < 100 ? maxNames : 100); if (!c->names) { fsfree(c->fpe_list); @@ -1403,52 +1406,17 @@ LoadGlyphRanges( int -RegisterFPEFunctions( - NameCheckFunc name_func, - InitFpeFunc init_func, - FreeFpeFunc free_func, - ResetFpeFunc reset_func, - OpenFontFunc open_func, - CloseFontFunc close_func, - ListFontsFunc list_func, - StartLfwiFunc start_lfwi_func, - NextLfwiFunc next_lfwi_func, - WakeupFpeFunc wakeup_func, - ClientDiedFunc client_died, - LoadGlyphsFunc load_glyphs, - StartLaFunc start_list_alias_func, - NextLaFunc next_list_alias_func, - SetPathFunc set_path_func) +register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs) { - FPEFunctions *new; + xfont2_fpe_funcs_rec *new; /* grow the list */ - new = (FPEFunctions *) fsrealloc(fpe_functions, - (num_fpe_types + 1) * sizeof(FPEFunctions)); + new = fsrealloc(fpe_functions, (num_fpe_types + 1) * sizeof(*new)); if (!new) return -1; fpe_functions = new; - fpe_functions[num_fpe_types].name_check = name_func; - fpe_functions[num_fpe_types].open_font = open_func; - fpe_functions[num_fpe_types].close_font = close_func; - fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func; - fpe_functions[num_fpe_types].list_fonts = list_func; - fpe_functions[num_fpe_types].start_list_fonts_with_info = - start_lfwi_func; - fpe_functions[num_fpe_types].list_next_font_with_info = - next_lfwi_func; - fpe_functions[num_fpe_types].init_fpe = init_func; - fpe_functions[num_fpe_types].free_fpe = free_func; - fpe_functions[num_fpe_types].reset_fpe = reset_func; - - fpe_functions[num_fpe_types].client_died = client_died; - fpe_functions[num_fpe_types].load_glyphs = load_glyphs; - fpe_functions[num_fpe_types].start_list_fonts_and_aliases = - start_list_alias_func; - fpe_functions[num_fpe_types].list_next_font_or_alias = - next_list_alias_func; - fpe_functions[num_fpe_types].set_path_hook = set_path_func; + memcpy(&fpe_functions[num_fpe_types], funcs, sizeof(*funcs)); return num_fpe_types++; } @@ -1486,9 +1454,9 @@ static int fs_handlers_installed = 0; static unsigned int last_server_gen; int -init_fs_handlers( +xfs_init_fs_handlers( FontPathElementPtr fpe, - BlockHandlerProcPtr block_handler) + FontBlockHandlerProcPtr block_handler) { /* if server has reset, make sure the b&w handlers are reinstalled */ if (last_server_gen < serverGeneration) { @@ -1511,9 +1479,9 @@ init_fs_handlers( } void -remove_fs_handlers( +xfs_remove_fs_handlers( FontPathElementPtr fpe, - BlockHandlerProcPtr block_handler, + FontBlockHandlerProcPtr block_handler, Bool all) { if (all) { diff --git a/difs/initfonts.c b/difs/initfonts.c index 3b2551a..f008967 100644 --- a/difs/initfonts.c +++ b/difs/initfonts.c @@ -49,20 +49,55 @@ in this Software without prior written authorization from The Open Group. #include "config.h" +#include <stddef.h> #include <X11/fonts/font.h> +#include <X11/fonts/fontstruct.h> +#include <X11/fonts/libxfont2.h> #include "difs.h" #include "globals.h" -FontPatternCachePtr fontPatternCache; +xfont2_pattern_cache_ptr fontPatternCache; + +static unsigned long +GetServerGeneration(void) +{ + return serverGeneration; +} + +static const xfont2_client_funcs_rec xfs_client_funcs = { + .version = XFONT2_CLIENT_FUNCS_VERSION, + .client_auth_generation = client_auth_generation, + .client_signal = ClientSignal, + .delete_font_client_id = DeleteFontClientID, + .verrorf = NULL, + .find_old_font = find_old_font, + .get_client_resolutions = GetClientResolutions, + .get_default_point_size = GetDefaultPointSize, + .get_new_font_client_id = GetNewFontClientID, + .get_time_in_millis = GetTimeInMillis, + .init_fs_handlers = xfs_init_fs_handlers, + .register_fpe_funcs = register_fpe_funcs, + .remove_fs_handlers = xfs_remove_fs_handlers, + .get_server_client = NULL, + .set_font_authorizations = set_font_authorizations, + .store_font_client_font = StoreFontClientFont, + .make_atom = MakeAtom, + .valid_atom = ValidAtom, + .name_for_atom = NameForAtom, + .get_server_generation = GetServerGeneration, + .add_fs_fd = NULL, + .remove_fs_fd = NULL, + .adjust_fs_wait_for_delay = NULL, +}; void InitFonts(void) { if (fontPatternCache) - FreeFontPatternCache(fontPatternCache); - fontPatternCache = MakeFontPatternCache(); + xfont2_free_font_pattern_cache(fontPatternCache); + fontPatternCache = xfont2_make_font_pattern_cache(); - ResetFontPrivateIndex(); + // ResetFontPrivateIndex(); - register_fpe_functions(); + xfont2_init(&xfs_client_funcs); } diff --git a/include/difs.h b/include/difs.h index d92f74b..66c7f98 100644 --- a/include/difs.h +++ b/include/difs.h @@ -29,7 +29,6 @@ #include "difsfn.h" #include "globals.h" #include <X11/fonts/fontstruct.h> -#include <X11/fonts/fontmisc.h> typedef int (*InitialFunc)(ClientPtr); typedef int (*ProcFunc)(ClientPtr); @@ -65,6 +64,13 @@ extern int StartListFontsWithInfo ( ClientPtr client, int length, unsigned char extern int LoadGlyphRanges ( ClientPtr client, FontPtr pfont, Bool range_flag, int num_ranges, int item_size, fsChar2b *data ); extern FontPtr find_old_font ( FSID id ); extern void DeleteClientFontStuff ( ClientPtr client ); +extern int xfs_init_fs_handlers(FontPathElementPtr fpe, + FontBlockHandlerProcPtr block_handler); + +extern void xfs_remove_fs_handlers(FontPathElementPtr fpe, + FontBlockHandlerProcPtr block_handler, + Bool all); +extern int register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs); /* difs/fontinfo.c */ extern int convert_props ( FontInfoPtr pinfo, fsPropInfo **props ); diff --git a/include/difsutils.h b/include/difsutils.h index 68e6f0e..fa922d8 100644 --- a/include/difsutils.h +++ b/include/difsutils.h @@ -30,7 +30,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <auth.h> #include <X11/fonts/font.h> #include <X11/fonts/fontstruct.h> -#include <X11/fonts/fontmisc.h> +#include <X11/fonts/libxfont2.h> typedef void (*DifsWakeupFunc)(pointer data, int result, unsigned long * pReadmask); typedef Bool (*DifsWorkFunc) (ClientPtr, pointer); @@ -39,7 +39,7 @@ extern AuthContextPtr GetClientAuthorization (void); extern Bool ClientIsAsleep (ClientPtr client); extern Bool ClientSleep (ClientPtr client, Bool (*function) (ClientPtr, pointer), pointer data); extern Bool QueueWorkProc (DifsWorkFunc function, ClientPtr client, pointer data); -extern Bool RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); +extern Bool RegisterBlockAndWakeupHandlers (FontBlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); #if 0 extern FontResolutionPtr GetClientResolutions (int *num); #endif @@ -50,7 +50,7 @@ extern int SetDefaultResolutions (char *str); #if 0 extern int client_auth_generation (ClientPtr client); #endif -extern int set_font_authorizations (char **authorizations, int *authlen, ClientPtr client); +extern int set_font_authorizations (char **authorizations, int *authlen, void *_client); extern int strncmpnocase (const char *first, const char *second, int n); extern pointer Xalloc (unsigned long m); extern pointer Xrealloc (pointer n, unsigned long m); @@ -59,7 +59,7 @@ extern void ClientWakeup (ClientPtr client); extern void InitBlockAndWakeupHandlers (void); extern void NoopDDA (void); extern void ProcessWorkQueue (void); -extern void RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); +extern void RemoveBlockAndWakeupHandlers (FontBlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); extern void SetDefaultPointSize (int ps); extern void WakeupHandler (int result, unsigned long * pReadmask); extern void Xfree (unsigned long *n); diff --git a/include/globals.h b/include/globals.h index 1bcf017..82a795f 100644 --- a/include/globals.h +++ b/include/globals.h @@ -50,7 +50,7 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/FSproto.h> /* for fsResolution */ #include <X11/Xtrans/Xtrans.h> /* XtransConnInfo */ -#include <X11/fonts/font.h> /* FontPatternCachePtr */ +#include <X11/fonts/libxfont2.h> /* xfont2_pattern_cache_ptr */ #include <X11/Xpoll.h> /* select & fd_set */ #include "client.h" /* WorkQueuePtr */ #include "misc.h" /* OldListenRec */ @@ -84,7 +84,7 @@ extern Bool NewOutputPending; extern int ConnectionTranslation[]; -extern FontPatternCachePtr fontPatternCache; +extern xfont2_pattern_cache_ptr fontPatternCache; extern long LastReapTime; extern Bool drone_server; diff --git a/include/misc.h b/include/misc.h index f0da949..e04d41c 100644 --- a/include/misc.h +++ b/include/misc.h @@ -111,11 +111,9 @@ in this Software without prior written authorization from The Open Group. ((char *) &(dst))[1] = ((char *) &(src))[0]; -#if 0 -extern void NoopDDA(void); -extern char *NameForAtom(Atom atom); -#endif - +extern int ValidAtom(Atom atom); +extern const char *NameForAtom(Atom atom); +extern Atom MakeAtom(const char *string, unsigned int len, Bool makeit); #define fsCat(x,y) x##_##y @@ -175,4 +173,8 @@ extern void CreateSockets(int old_listen_count, OldListenRec *old_listen); /* os/xfstrans.c */ extern OldListenRec *_FontTransGetInetdListenInfo (int fd); +extern void BitOrderInvert(unsigned char *buf, int nbytes); +extern void TwoByteSwap(unsigned char *buf, int nbytes); +extern void FourByteSwap(unsigned char *buf, int nbytes); + #endif /* _MISC_H_ */ diff --git a/include/os.h b/include/os.h index e07d4e0..92ad5f5 100644 --- a/include/os.h +++ b/include/os.h @@ -130,7 +130,7 @@ extern void CleanupChild (int n); extern void GiveUp (int n); extern void ServerCacheFlush (int n); extern void ServerReconfig (int n); -extern long GetTimeInMillis (void); +extern unsigned int GetTimeInMillis (void); extern pointer FSalloc(unsigned long); extern pointer FScalloc (unsigned long amount); extern pointer FSrealloc(pointer, unsigned long); diff --git a/os/config.c b/os/config.c index 81275ea..d651d7e 100644 --- a/os/config.c +++ b/os/config.c @@ -58,9 +58,8 @@ in this Software without prior written authorization from The Open Group. #include "globals.h" #include "access.h" #include "difsutils.h" -#include <X11/fonts/fontutil.h> #include "difs.h" -#include <X11/fonts/fontconf.h> +#include <X11/fonts/libxfont2.h> /* libXfont/src/bitmap/snfstr.h */ extern void SnfSetFormat(int bit, int byte, int glyph, int scan); @@ -589,7 +588,7 @@ config_set_glyph_caching_mode( t = *val; *val = '\0'; if (!strcmp(parm->parm_name, "deferglyphs")) { - ParseGlyphCachingMode(start); + xfont2_parse_glyph_caching_mode(start); } *val = t; return val; @@ -178,7 +178,7 @@ CleanupChild(int n) errno = olderrno; } -long +unsigned int GetTimeInMillis(void) { struct timeval tp; @@ -551,3 +551,86 @@ StorePid (void) } return 0; } + +static const unsigned char _reverse_byte[0x100] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff +}; + +/* + * Invert bit order within each BYTE of an array. + */ +void +BitOrderInvert(unsigned char *buf, int nbytes) +{ + const unsigned char *rev = _reverse_byte; + + for (; --nbytes >= 0; buf++) + *buf = rev[*buf]; +} + +/* + * Invert byte order within each 16-bits of an array. + */ +void +TwoByteSwap(unsigned char *buf, int nbytes) +{ + unsigned char c; + + for (; nbytes > 0; nbytes -= 2, buf += 2) + { + c = buf[0]; + buf[0] = buf[1]; + buf[1] = c; + } +} + +/* + * Invert byte order within each 32-bits of an array. + */ +void +FourByteSwap(unsigned char *buf, int nbytes) +{ + unsigned char c; + + for (; nbytes > 0; nbytes -= 4, buf += 4) + { + c = buf[0]; + buf[0] = buf[3]; + buf[3] = c; + c = buf[1]; + buf[1] = buf[2]; + buf[2] = c; + } +} + diff --git a/os/xfstrans.c b/os/xfstrans.c index edc1d05..8e7880f 100644 --- a/os/xfstrans.c +++ b/os/xfstrans.c @@ -30,7 +30,13 @@ #ifdef XFS_INETD /* xfs special handling for listen socket passed from inetd */ -#include "misc.h" + +/* XXX duplicated from misc.h */ +typedef struct { /* when cloning, need old transport info */ + int trans_id; + int fd; + int portnum; +} OldListenRec; OldListenRec * TRANS(GetInetdListenInfo) (int fd) |