1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
13 /*---------------------------------------------------------------------------
15 Test program used to test the DMAPI function dm_sync_by_handle(). The
18 sync_by_handle [-s sid] pathname
21 'sid' is the session ID to use for the call.
22 'pathname' is the name of the file to be sync'd.
24 ----------------------------------------------------------------------------*/
27 extern char *sys_errlist[];
39 fprintf(stderr, "usage:\t%s [-s sid] pathname\n", Progname);
49 dm_sessid_t sid = DM_NO_SESSION;
50 char *pathname = NULL;
56 Progname = strrchr(argv[0], '/');
63 /* Crack and validate the command line options. */
65 while ((opt = getopt(argc, argv, "s:")) != EOF) {
74 if (optind + 1 != argc)
76 pathname = argv[optind];
78 if (dm_init_service(&name) == -1) {
79 fprintf(stderr, "Can't initialize the DMAPI\n");
82 if (sid == DM_NO_SESSION)
83 find_test_session(&sid);
85 /* Get the file's handle. */
87 if (dm_path_to_handle(pathname, &hanp, &hlen)) {
88 fprintf(stderr, "can't get handle for file %s\n", pathname);
92 if (dm_sync_by_handle(sid, hanp, hlen, DM_NO_TOKEN)) {
93 fprintf(stderr, "dm_sync_by_handle failed, %s\n",
97 dm_handle_free(hanp, hlen);