fsrtns.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $TOG: fsrtns.h /main/6 1998/10/26 12:42:04 mgreess $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. *
  27. * FILE: fsrtns.h
  28. *
  29. *
  30. * DESCRIPTION: Header files used in dosync.c,fsrtns.c,main_dtcopy.c
  31. *
  32. * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
  33. * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
  34. * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
  35. * (c) Copyright 1993, 1994, 1995 Novell, Inc.
  36. *
  37. ****************************************************************************
  38. ************************************<+>*************************************/
  39. #ifndef _fsrtns_h
  40. #define _fsrtns_h
  41. /*
  42. * General comments:
  43. *
  44. * The file systems routines below support renaming, moving, copying,
  45. * and deleting single files as well as directories. The operations
  46. * check return codes on close, so they are safe to use with AFS.
  47. *
  48. * If the operation failed, the the reason for the failure (errno value)
  49. * is returned in *rcP.
  50. *
  51. * The rename, move and copy routines all take a parameter 'replace'
  52. * that determines what happens if the target file/directory already
  53. * exists: if 'replace' is zero, the routines return an ENOENT error;
  54. * if 'replace' is non-zero the routines will replace any existing
  55. * files/directories.
  56. *
  57. * The copy and move operations preserve the modified timestamps and
  58. * file permissions of the source. If the calling program is running
  59. * as root, file ownership is also preserved.
  60. */
  61. /*
  62. * fsRename:
  63. * Renames or moves source to target.
  64. * Source and target must be on the same file system.
  65. */
  66. extern void fsRename(char *source, char *target, int replace, int *rcP);
  67. /*
  68. * fsMove:
  69. * Like fsRename, but also works if source and target are on different
  70. * file systems by copying source to target and then deleting source.
  71. */
  72. extern void fsMove(char *source, char *target, int replace, int *rcP);
  73. /*
  74. * fsCopy:
  75. * Copies source to target.
  76. */
  77. extern void fsCopy(char *source, char *target, int replace, int *rcP);
  78. /*
  79. * fsCopyLink:
  80. * Like fsCopy, but copies symbolic links as links, i.e.,creates a link
  81. * that points to the same place as the source link. Applies in the case
  82. * where source itself is a symbolic link, as well as the case where
  83. * source is a directory that contains symbolic links.
  84. */
  85. extern void fsCopyLink(char *source, char *target, int replace, int *rcP);
  86. /*
  87. * fsErase:
  88. * Deletes a file or directory.
  89. */
  90. extern void fsErase(char *name, int *rcP, int force);
  91. /*
  92. * fsEmpty:
  93. * Deletes all files/directries in the named directory.
  94. *
  95. */
  96. extern void fsEmpty(char *name, int *rcP);
  97. /*
  98. * Callback functions:
  99. *
  100. * progressCallback:
  101. * called each time a new file or directory is being processed
  102. *
  103. * errorCallback:
  104. * called when a file operation fails
  105. *
  106. * periodicCallback:
  107. * called periodically
  108. *
  109. * Each callback function should return zero if the file operation
  110. * is supposed to continue. To abort the operation, return a non-zero
  111. * value from one of the callback functions.
  112. */
  113. extern int (*progressCallback)(char *fname);
  114. extern int (*errorCallback)(char *fname, int errnum);
  115. extern int (*periodicCallback)(void);
  116. #endif /* _fsrtns_h */