1 /* this file is part of srm http://srm.sourceforge.net/ 2 It is licensed under the MIT/X11 license */ 3 4 #ifndef SRM__H 5 #define SRM__H 6 7 /** the lower three bits of the option argument to sunlink() set the verbosity level. */ 8 #define SRM_OPT_V 7 9 /** force unlink */ 10 #define SRM_OPT_F (1 << 3) 11 /** interactive unlink, ask before handling a file */ 12 #define SRM_OPT_I (1 << 4) 13 /** recursive */ 14 #define SRM_OPT_R (1 << 5) 15 /** do not cross file system boundaries */ 16 #define SRM_OPT_X (1 << 6) 17 /** simple overwrite mode */ 18 #define SRM_MODE_SIMPLE (1 << 16) 19 /** OpenBSD overwrite mode */ 20 #define SRM_MODE_OPENBSD (1 << 17) 21 /** US DoD overwrite mode */ 22 #define SRM_MODE_DOD (1 << 18) 23 /** US DoE overwrite mode */ 24 #define SRM_MODE_DOE (1 << 19) 25 /** 35-pass overwrite mode */ 26 #define SRM_MODE_35 (1 << 20) 27 /** RCMP overwrite mode */ 28 #define SRM_MODE_RCMP (1 << 21) 29 30 /** bitmask of overwrite modes */ 31 #define SRM_MODE_MASK (SRM_MODE_SIMPLE|SRM_MODE_OPENBSD|SRM_MODE_DOD|SRM_MODE_DOE|SRM_MODE_35|SRM_MODE_RCMP) 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /** unlink a file/directory in a secure way. 38 39 Before the file/directory is unlinked it's name is renamed to a 40 random filename, so that the original name can not be 41 reconstructed with special tools. This function does not overwrite 42 the file contents before unlinking! Use sunlink() for that 43 purpose. 44 45 This function sets errno. 46 47 @param path (absolute) path to file/directory 48 @return 0 upon success, negative upon error 49 */ 50 int rename_unlink(const char *path); 51 52 /** unlink a file/directory in a secure way. 53 54 This function will overwrite the file contents before unlinking 55 the file. This prevents special tools from reconstructing the 56 unlinked file. 57 58 This function sets errno. 59 60 @param path (absolute) path to file/directory 61 @param options a combination of SRM_* flags 62 63 @return 0 upon success, negative upon error 64 */ 65 int sunlink(const char *path, const int options); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif 72