1 /* unieject - Universal eject command 2 Copyright (C) 2005-2006, Diego Pettenò 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with unieject; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef __UNIEJECT_INTERNAL_H__ 20 #define __UNIEJECT_INTERNAL_H__ 21 22 #include <config.h> 23 #include <string.h> 24 25 #include <unieject.h> 26 27 #if SUPPORT_ATTRIBUTE_FORMAT 28 # define PRINTF_LIKE(x, y) __attribute__( ( format(printf, x, y) ) ) 29 #else 30 # define PRINTF_LIKE(x, y) 31 #endif 32 33 #if SUPPORT_ATTRIBUTE_VISIBILITY_INTERNAL 34 # define INTERNAL __attribute__( ( visibility("internal") ) ) 35 #elif SUPPORT_ATTRIBUTE_VISIBILITY_HIDDEN 36 # define HIDDEN __attribute__( ( visibility("hidden") ) ) 37 #else 38 # define INTERNAL 39 #endif 40 41 #if SUPPORT_ATTRIBUTE_NONNULL 42 # define NONNULL(...) __attribute__( ( nonnull(__VA_ARGS__) ) ) 43 #else 44 # define NONNULL(...) 45 #endif 46 47 #if SUPPORT_ATTRIBUTE_UNUSED 48 # define UNUSED __attribute__( ( __unused__ ) ) 49 #else 50 # define UNUSED 51 #endif 52 53 #if SUPPORT__BUILTIN_EXPECT 54 # define LIKELY(x) __builtin_expect(!!(x), 1) 55 # define UNLIKELY(x) __builtin_expect(!!(x), 0) 56 #else 57 # define LIKELY(x) x 58 # define UNLIKELY(x) x 59 #endif 60 61 char INTERNAL *simplifylink(const char *link) NONNULL(); 62 char INTERNAL *checkmount(char **device) NONNULL(); 63 bool INTERNAL internal_umountdev(struct unieject_opts opts, char *device) NONNULL(); 64 65 /** 66 * @brief Returns the root device, if the given device is actually a partition 67 * @param device Device to check 68 */ 69 char INTERNAL *rootdevice(char *device) NONNULL(); 70 71 int INTERNAL unieject_status(int sts); 72 cdio_drive_misc_cap_t INTERNAL unieject_get_misccaps(const struct unieject_opts opts); 73 74 /* Gettext stuff */ 75 #include <gettext.h> 76 #ifdef ENABLE_NLS 77 # define _(x) dgettext("unieject", x) 78 #else 79 # define _(x) x 80 #endif 81 82 #endif 83