gensio_to_sergensio.3(3)

✨ gensio_to_sergensio β€” the sergensio conversion lore ✨

okay bestie, so this page lives in the Library Functions Manual (gensio_to_sergensio.3), and it's literally your one-stop shop for all the general info and conversion routines for a sergensio. iykyk πŸ’…


🌸 SYNOPSIS 🌸

#include <gensio/sergensio.h>

struct sergensio *gensio_to_sergensio(struct gensio *io);

struct gensio *sergensio_to_gensio(struct sergensio *serio);

void *sergensio_get_user_data(struct sergensio *serio);

bool sergensio_is_client(struct sergensio *serio);

πŸ¦‹ DESCRIPTION πŸ¦‹

gensio_to_sergensio β€” the glow-up ✨

gensio_to_sergensio hands you back the sergensio object for a gensio. and like… it returns NULL if there's genuinely no sergensio for that gensio, no cap. 🫢

heads up bestie: the sergensio it gives you might be a sergensio object for a child of the gensio you passed in. plot twist, i know. 😭

so if the gensio you passed in isn't a sergensio itself, it goes searching through the children looking for a gensio that is also a sergensio. iconic detective behaviour honestly. πŸ”

the way this is useful: say you have a conacc gensio running over a serialdev, and you get a serial event β€” you can just call gensio_to_sergensio on the object that got passed in, and it'll hand you the sergensio you should actually be working with. so convenient. so slay. πŸ‘‘

and the first time you call this on a gensio, it associates the sergensio with the gensio you passed in. first-call-makes-it-official energy. πŸ’–

sergensio_to_gensio β€” the reverse ✨

sergensio_to_gensio gives you the gensio for a given sergensio. it cannot fail. periodt. πŸ’―

note though: this returns the gensio that was passed in to gensio_to_sergensio β€” not the gensio directly associated with the sergensio you passed in. sneaky but true, fr fr.

sergensio_get_user_data β€” the data retrieval ✨

sergensio_get_user_data returns the gensio user data for the associated gensio. that's it, that's the whole vibe. πŸŽ€

sergensio_is_client β€” the vibe check ✨

sergensio_is_client returns true if the sergensio is a client, or false if it's a server. two moods only. 🌈


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHOR πŸ’œ

Corey Minyard <minyard@acm.org> β€” the actual main character who wrote all this. we stan. πŸ‘‘


and that's the whole page bestie, no notes. this was gensio_to_sergensio.3(3) from the Library Functions Manual, dated 20 Jul 2020, and it ATE. go forth and convert your sergensios responsibly. πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from