701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik/*
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik SSSD
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik sss_format.h
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik Authors:
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik Lukas Slebodnik <lslebodn@redhat.com>
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik Copyright (C) 2013 Red Hat
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik This program is free software; you can redistribute it and/or modify
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik it under the terms of the GNU General Public License as published by
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik the Free Software Foundation; either version 3 of the License, or
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik (at your option) any later version.
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik This program is distributed in the hope that it will be useful,
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik but WITHOUT ANY WARRANTY; without even the implied warranty of
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik GNU General Public License for more details.
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik You should have received a copy of the GNU General Public License
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik along with this program. If not, see <http://www.gnu.org/licenses/>.
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik*/
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik#ifndef __SSS_FORMAT_H__
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik#define __SSS_FORMAT_H__
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik#include <inttypes.h>
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik
ec0b19bd6d25e3f4afea06b28c132b602bbff180Lukas Slebodnik/* key_serial_t is defined in keyutils.h as typedef int32_t */
ec0b19bd6d25e3f4afea06b28c132b602bbff180Lukas Slebodnik#define SPRIkey_ser PRId32
ec0b19bd6d25e3f4afea06b28c132b602bbff180Lukas Slebodnik
10a9ff0c9b4f347ec24dab887a538b37274ee498Lukas Slebodnik/* rlim_t is defined with conditional build as unsigned type.
10a9ff0c9b4f347ec24dab887a538b37274ee498Lukas Slebodnik * It seems that sizeof(rlim_t) is 8. It may be platform dependent, therefore
10a9ff0c9b4f347ec24dab887a538b37274ee498Lukas Slebodnik * the same format will be used like with uint64_t.
10a9ff0c9b4f347ec24dab887a538b37274ee498Lukas Slebodnik */
10a9ff0c9b4f347ec24dab887a538b37274ee498Lukas Slebodnik#define SPRIrlim PRIu64
10a9ff0c9b4f347ec24dab887a538b37274ee498Lukas Slebodnik
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#if SIZEOF_ID_T == 8
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# define SPRIid PRIu64
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#elif SIZEOF_ID_T == 4
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# define SPRIid PRIu32
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#else
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# error Unexpected sizeof id_t
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#endif /* SIZEOF_ID_T */
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#if SIZEOF_UID_T == 8
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# define SPRIuid PRIu64
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#elif SIZEOF_UID_T == 4
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# define SPRIuid PRIu32
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#else
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# error Unexpected sizeof uid_t
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#endif /* SIZEOF_UID_T */
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#if SIZEOF_GID_T == 8
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# define SPRIgid PRIu64
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#elif SIZEOF_GID_T == 4
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# define SPRIgid PRIu32
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#else
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik# error Unexpected sizeof gid_t
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik#endif /* SIZEOF_GID_T */
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik
af58b15fa7f20e33736d79c6a4b3becb568517caLukas Slebodnik
701f13b5c8e27bcbfc79e77ce7c76d9f768a448cLukas Slebodnik#endif /* __SSS_FORMAT_H__ */