au_util.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2005-2009 Junjiro Okajima
  3. *
  4. * This program, aufs 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 this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __AUFS_UTIL_H__
  19. #define __AUFS_UTIL_H__
  20. #include <errno.h>
  21. #include <error.h>
  22. /*
  23. * error_at_line() is decleared with (__printf__, 5, 6) attribute,
  24. * and our compiler produces a warning unless args is not given.
  25. * __VA_ARGS__ does not help the attribute.
  26. */
  27. #define AuFin(fmt, args...) \
  28. error_at_line(errno, errno, __FILE__, __LINE__, fmt, ##args)
  29. #ifdef DEBUG
  30. #define MTab "/tmp/mtab"
  31. #else
  32. #define MTab "/etc/mtab"
  33. #endif
  34. /* proc_mounts.c */
  35. struct mntent;
  36. int au_proc_getmntent(char *mntpnt, struct mntent *rent);
  37. /* br.c */
  38. int au_br(char ***br, int *nbr, struct mntent *ent);
  39. /* plink.c */
  40. enum {
  41. AuPlink_FLUSH,
  42. AuPlink_CPUP,
  43. AuPlink_LIST
  44. };
  45. int au_plink(char cwd[], int cmd, int begin_maint, int end_maint);
  46. void au_plink_maint(char *path);
  47. /* mtab.c */
  48. void au_print_ent(struct mntent *ent);
  49. int au_update_mtab(char *mntpnt, int do_remount, int do_verbose);
  50. #define _Dpri(fmt, ...) printf("%s:%d:" fmt, \
  51. __func__, __LINE__, ##__VA_ARGS__)
  52. #ifdef DEBUG
  53. #define Dpri(fmt, ...) _Dpri(fmt, ##__VA_ARGS__)
  54. #else
  55. #define Dpri(fmt, ...) do { } while(0)
  56. #endif
  57. #endif /* __AUFS_UTIL_H__ */