]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
043c3c62 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2003-2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
043c3c62 NS |
5 | */ |
6 | ||
dcabd4e7 | 7 | #include "platform_defs.h" |
6b803e5a | 8 | #include "command.h" |
043c3c62 | 9 | #include "init.h" |
48c46ee3 | 10 | #include "io.h" |
043c3c62 NS |
11 | |
12 | static cmdinfo_t fsync_cmd; | |
13 | static cmdinfo_t fdatasync_cmd; | |
14 | ||
15 | static int | |
16 | fsync_f( | |
17 | int argc, | |
18 | char **argv) | |
19 | { | |
48c46ee3 | 20 | if (fsync(file->fd) < 0) { |
043c3c62 NS |
21 | perror("fsync"); |
22 | return 0; | |
23 | } | |
24 | return 0; | |
25 | } | |
26 | ||
27 | static int | |
28 | fdatasync_f( | |
29 | int argc, | |
30 | char **argv) | |
31 | { | |
48c46ee3 | 32 | if (fdatasync(file->fd) < 0) { |
043c3c62 NS |
33 | perror("fdatasync"); |
34 | return 0; | |
35 | } | |
36 | return 0; | |
37 | } | |
38 | ||
39 | void | |
40 | fsync_init(void) | |
41 | { | |
ad765595 AM |
42 | fsync_cmd.name = "fsync"; |
43 | fsync_cmd.altname = "s"; | |
043c3c62 | 44 | fsync_cmd.cfunc = fsync_f; |
48c46ee3 | 45 | fsync_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK; |
043c3c62 NS |
46 | fsync_cmd.oneline = |
47 | _("calls fsync(2) to flush all in-core file state to disk"); | |
48 | ||
ad765595 AM |
49 | fdatasync_cmd.name = "fdatasync"; |
50 | fdatasync_cmd.altname = "ds"; | |
043c3c62 | 51 | fdatasync_cmd.cfunc = fdatasync_f; |
48c46ee3 | 52 | fdatasync_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK; |
043c3c62 NS |
53 | fdatasync_cmd.oneline = |
54 | _("calls fdatasync(2) to flush the files in-core data to disk"); | |
55 | ||
56 | add_command(&fsync_cmd); | |
57 | add_command(&fdatasync_cmd); | |
58 | } |